Fixed a bug regarding SetImageSource()
authorBongjoo Seo <bongjoo.seo@samsung.com>
Mon, 10 Jun 2013 00:27:06 +0000 (09:27 +0900)
committerBongjoo Seo <bongjoo.seo@samsung.com>
Mon, 10 Jun 2013 00:27:06 +0000 (09:27 +0900)
Change-Id: I703497971d5a2dfc5d683bee06db2c184654e322
Signed-off-by: Bongjoo Seo <bongjoo.seo@samsung.com>
src/ui/animations/FUiAnim_VisualElementImpl.cpp

index ff4076c..a86708e 100644 (file)
@@ -484,26 +484,6 @@ _VisualElementImpl::FlushI(void)
        return _DisplayManager::GetInstance()->Flush();
 }
 
-result
-_VisualElementImpl::SetImageSource(const String& filePath)
-{
-       result r = E_SUCCESS;
-       RebuildHierarchyProps(0, true, true);
-
-       SysTryReturnResult(NID_UI_ANIM, HAVE_SURFACE(this), E_SYSTEM, "Realizing back-buffer surface failed.");
-
-       if (!filePath.IsEmpty())
-       {
-               r = GetSharedData().SetImage(filePath);
-               SysTryLog(NID_UI_ANIM, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
-       }
-
-       __imageFilePath = filePath;
-
-       return r;
-}
-
-
 bool
 _VisualElementImpl::CreateImplicitAnimationIfNeeded( const String& property,
                const Variant& newValue, const Variant& currentPresentationValue, const String** pSubProperties)
@@ -986,6 +966,41 @@ _VisualElementImpl::SetSurface(const VisualElementSurface* pSurface)
        return E_SUCCESS;
 }
 
+result
+_VisualElementImpl::SetImageSource(const String& filePath)
+{
+       result r = E_SUCCESS;
+
+       // Delete the old surface
+       if (GetSharedData().pSurface)
+       {
+               delete GetSharedData().pSurface;
+       }
+
+       __needRecreateSurface = true;
+
+       GetSharedData().pSurface = null;
+       GetSharedData().fixedSurfaceSize = false;
+
+       // Fully invalidate because new surface should be allocated and redrawn
+       GetSharedData().invalidatedRegion.SetBounds(0.0f, 0.0f, __bounds.width, __bounds.height);
+
+
+       RebuildHierarchyProps(0, true, true);
+
+       SysTryReturnResult(NID_UI_ANIM, HAVE_SURFACE(this), E_SYSTEM, "Realizing back-buffer surface failed.");
+
+       if (!filePath.IsEmpty())
+       {
+               r = GetSharedData().SetImage(filePath);
+               SysTryLog(NID_UI_ANIM, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
+       }
+
+       __imageFilePath = filePath;
+
+       return r;
+}
+
 void
 _VisualElementImpl::SetSurfaceChanged(void)
 {