[3.0] Destroy a previous egl image if SetSource gets new native buffer 80/117980/4
authortaeyoon0.lee <taeyoon0.lee@samsung.com>
Wed, 8 Mar 2017 07:39:49 +0000 (16:39 +0900)
committertaeyoon0.lee <taeyoon0.lee@samsung.com>
Thu, 9 Mar 2017 07:54:43 +0000 (16:54 +0900)
 - Destroy a previous egl image whenever SetSource gets new native buffer
 - It works in PrepareTexture()

Change-Id: I0657832b046bc75042c3ffbbb4d70ca46c6d11ae

adaptors/tizen/native-image-source-impl-tizen.cpp

index 591d8b5..c0e5da5 100755 (executable)
@@ -387,7 +387,7 @@ bool NativeImageSource::GlExtensionCreate()
 {
   // casting from an unsigned int to a void *, which should then be cast back
   // to an unsigned int in the driver.
-  EGLClientBuffer eglBuffer = reinterpret_cast< EGLClientBuffer > (mTbmSurface);
+  EGLClientBuffer eglBuffer = reinterpret_cast< EGLClientBuffer >(mTbmSurface);
   if( !eglBuffer )
   {
     return false;
@@ -417,9 +417,17 @@ unsigned int NativeImageSource::TargetTexture()
 
 void NativeImageSource::PrepareTexture()
 {
-  if( mSetSource && GlExtensionCreate() )
+  if( mSetSource )
   {
-    TargetTexture();
+    void* eglImage = mEglImageKHR;
+
+    if( GlExtensionCreate() )
+    {
+      TargetTexture();
+    }
+
+    mEglImageExtensions->DestroyImageKHR( eglImage );
+
     mSetSource = false;
   }
 }