Merge branch 'devel/master' into tizen
authorTaehyub Kim <taehyub.kim@samsung.com>
Tue, 8 Jun 2021 08:38:31 +0000 (17:38 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Tue, 8 Jun 2021 08:38:31 +0000 (17:38 +0900)
Change-Id: I225989d855b68d891257097eee0a42925aa4fe30

dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp

index 75417e4..f0b7a0e 100644 (file)
@@ -403,6 +403,12 @@ bool NativeImageSourceTizen::IsColorDepthSupported(Dali::NativeImageSource::Colo
 
 bool NativeImageSourceTizen::CreateResource()
 {
+  // If an EGL image exists, use it as it is without creating it.
+  if(mEglImageKHR != NULL)
+  {
+    return true;
+  }
+
   // 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);
@@ -445,15 +451,16 @@ void NativeImageSourceTizen::PrepareTexture()
   Dali::Mutex::ScopedLock lock(mMutex);
   if(mSetSource)
   {
-    void* eglImage = mEglImageKHR;
+    // Destroy previous eglImage because use for new one.
+    // if mEglImageKHR is not to be NULL here, it will not be updated with a new eglImage.
+    mEglImageExtensions->DestroyImageKHR(mEglImageKHR);
+    mEglImageKHR = NULL;
 
     if(CreateResource())
     {
       TargetTexture();
     }
 
-    mEglImageExtensions->DestroyImageKHR(eglImage);
-
     mSetSource = false;
   }
 }