2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 #include "texture-factory.h"
19 #include <dali/integration-api/bitmap.h>
20 #include <dali/internal/render/gl-resources/texture.h>
21 #include <dali/internal/render/gl-resources/bitmap-texture.h>
22 #include <dali/internal/render/gl-resources/compressed-bitmap-texture.h>
23 #include <dali/internal/render/gl-resources/native-texture.h>
24 #include <dali/internal/render/gl-resources/frame-buffer-texture.h>
25 #include <dali/internal/render/gl-resources/native-frame-buffer-texture.h>
26 #include <dali/public-api/images/native-image.h>
36 namespace TextureFactory
39 Internal::Texture* NewBitmapTexture( Integration::Bitmap* const bitmap, Context& context )
41 DALI_ASSERT_DEBUG( bitmap );
42 Texture * texture = 0;
43 Integration::Bitmap::PackedPixelsProfile * const packedPixelBitmapView = bitmap->GetPackedPixelsProfile();
44 if( packedPixelBitmapView )
46 texture = new BitmapTexture( bitmap, packedPixelBitmapView, context );
50 Internal::BitmapCompressed * const compressedBitmap = dynamic_cast<Dali::Internal::BitmapCompressed*>( bitmap );
51 if( compressedBitmap != 0 )
53 texture = new CompressedBitmapTexture( compressedBitmap, context );
58 if( !texture->Init() )
67 Internal::Texture* NewBitmapTexture( unsigned int width,
69 Pixel::Format pixelFormat,
73 Texture *texture=new BitmapTexture(width, height, pixelFormat, clearPixels, context);
79 Internal::Texture* NewNativeImageTexture( NativeImage& nativeImg, Context& context )
81 NativeTexture* texture = new NativeTexture(&nativeImg, context);
90 Internal::Texture* NewFrameBufferTexture( unsigned int width,
92 Pixel::Format pixelFormat,
95 FrameBufferTexture* texture = new FrameBufferTexture(width, height, pixelFormat, context);
104 Internal::Texture* NewFrameBufferTexture( NativeImagePtr nativeImage,
107 NativeFrameBufferTexture* texture = new NativeFrameBufferTexture(nativeImage, context);
108 if (!texture->Init())