[Tizen] Add API for setting resource destruction callback
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / android / native-image-source-impl-android.cpp
index 19312b5..280762c 100755 (executable)
 #include <dali/internal/graphics/gles/egl-graphics.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
 
+
+namespace
+{
+const char* FRAGMENT_PREFIX = "#extension GL_OES_EGL_image_external:require\n";
+const char* SAMPLER_TYPE = "samplerExternalOES";
+}
+
+
 namespace Dali
 {
 
@@ -66,7 +74,8 @@ NativeImageSourceAndroid::NativeImageSourceAndroid( uint32_t width, uint32_t hei
   mBlendingRequired( false ),
   mColorDepth( depth ),
   mEglImageKHR( NULL ),
-  mEglImageExtensions( NULL )
+  mEglImageExtensions( NULL ),
+  mResourceDestructionCallback()
 {
   DALI_ASSERT_ALWAYS( Adaptor::IsAvailable() );
 
@@ -217,12 +226,12 @@ bool NativeImageSourceAndroid::IsColorDepthSupported( Dali::NativeImageSource::C
   return true;
 }
 
-bool NativeImageSourceAndroid::GlExtensionCreate()
+bool NativeImageSourceAndroid::CreateResource()
 {
   // if the image existed previously delete it.
   if( mEglImageKHR != NULL )
   {
-    GlExtensionDestroy();
+    DestroyResource();
   }
 
   DALI_ASSERT_ALWAYS( mPixmap );
@@ -261,7 +270,7 @@ bool NativeImageSourceAndroid::GlExtensionCreate()
   return mEglImageKHR != NULL;
 }
 
-void NativeImageSourceAndroid::GlExtensionDestroy()
+void NativeImageSourceAndroid::DestroyResource()
 {
   mEglImageExtensions->DestroyImageKHR( mEglImageKHR );
 
@@ -279,6 +288,22 @@ void NativeImageSourceAndroid::PrepareTexture()
 {
 }
 
+int NativeImageSourceAndroid::GetTextureTarget() const
+{
+  return GL_TEXTURE_2D;
+}
+
+const char* NativeImageSourceAndroid::GetCustomFragmentPrefix() const
+{
+  return nullptr;
+}
+
+const char* NativeImageSourceAndroid::GetCustomSamplerTypename() const
+{
+  return nullptr;
+}
+
+
 void* NativeImageSourceAndroid::GetPixmapFromAny(Any pixmap) const
 {
   if( pixmap.Empty() )
@@ -357,6 +382,11 @@ bool NativeImageSourceAndroid::ReleaseBuffer()
   return false;
 }
 
+void NativeImageSourceAndroid::SetResourceDestructionCallback(EventThreadCallback* callback)
+{
+  mResourceDestructionCallback = std::unique_ptr<EventThreadCallback>(callback);
+}
+
 } // namespace Adaptor
 
 } // namespace internal