Merge branch 'devel/master' into devel/new_mesh
[platform/core/uifw/dali-core.git] / dali / internal / render / gl-resources / texture-factory.cpp
index 8d52e90..8a86b35 100644 (file)
 #include "texture-factory.h"
 
 #include <dali/integration-api/bitmap.h>
+#include <dali/integration-api/gl-defines.h>
 #include <dali/internal/render/gl-resources/texture.h>
 #include <dali/internal/render/gl-resources/bitmap-texture.h>
 #include <dali/internal/render/gl-resources/compressed-bitmap-texture.h>
 #include <dali/internal/render/gl-resources/native-texture.h>
 #include <dali/internal/render/gl-resources/frame-buffer-texture.h>
 #include <dali/internal/render/gl-resources/native-frame-buffer-texture.h>
-#include <dali/public-api/images/native-image.h>
 
 
 namespace Dali
 {
-class NativeImage;
+class NativeImageInterface;
 
 namespace Internal
 {
@@ -37,21 +37,21 @@ namespace Internal
 namespace TextureFactory
 {
 
-Internal::Texture* NewBitmapTexture( Integration::Bitmap* const bitmap, Context& context )
+Internal::Texture* NewBitmapTexture( Integration::Bitmap* const bitmap, Context& context, ResourcePolicy::Discardable discardPolicy )
 {
   DALI_ASSERT_DEBUG( bitmap );
   Texture * texture = 0;
   Integration::Bitmap::PackedPixelsProfile * const  packedPixelBitmapView = bitmap->GetPackedPixelsProfile();
   if( packedPixelBitmapView )
   {
-    texture = new BitmapTexture( bitmap, packedPixelBitmapView, context );
+    texture = new BitmapTexture( bitmap, packedPixelBitmapView, context, discardPolicy );
   }
   else
   {
     Internal::BitmapCompressed * const compressedBitmap = dynamic_cast<Dali::Internal::BitmapCompressed*>( bitmap );
     if( compressedBitmap != 0 )
     {
-      texture = new CompressedBitmapTexture( compressedBitmap, context );
+      texture = new CompressedBitmapTexture( compressedBitmap, context, discardPolicy );
     }
   }
   if( texture )
@@ -69,15 +69,16 @@ Internal::Texture* NewBitmapTexture( unsigned int      width,
                                      unsigned int      height,
                                      Pixel::Format     pixelFormat,
                                      bool              clearPixels,
-                                     Context&          context )
+                                     Context&          context,
+                                     ResourcePolicy::Discardable discardPolicy )
 {
-  Texture *texture=new BitmapTexture(width, height, pixelFormat, clearPixels, context);
+  Texture *texture=new BitmapTexture(width, height, pixelFormat, clearPixels, context, discardPolicy);
 
   return texture;
 }
 
 
-Internal::Texture* NewNativeImageTexture( NativeImage& nativeImg, Context& context )
+Internal::Texture* NewNativeImageTexture( NativeImageInterface& nativeImg, Context& context )
 {
   NativeTexture* texture = new NativeTexture(&nativeImg, context);
   if (!texture->Init())
@@ -102,7 +103,7 @@ Internal::Texture* NewFrameBufferTexture( unsigned int width,
   return texture;
 }
 
-Internal::Texture* NewFrameBufferTexture( NativeImagePtr nativeImage,
+Internal::Texture* NewFrameBufferTexture( NativeImageInterfacePtr nativeImage,
                                           Context& context )
 {
   NativeFrameBufferTexture* texture = new NativeFrameBufferTexture(nativeImage, context);
@@ -119,4 +120,3 @@ Internal::Texture* NewFrameBufferTexture( NativeImagePtr nativeImage,
 } // TextureFactory
 } // Internal
 } // Dali
-