From 24e9e0dc0c9fea59cf8c38452114b5b945aaa509 Mon Sep 17 00:00:00 2001 From: Bongjoo Seo Date: Mon, 10 Jun 2013 09:27:06 +0900 Subject: [PATCH] Fixed a bug regarding SetImageSource() Change-Id: I703497971d5a2dfc5d683bee06db2c184654e322 Signed-off-by: Bongjoo Seo --- src/ui/animations/FUiAnim_VisualElementImpl.cpp | 55 ++++++++++++++++--------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/src/ui/animations/FUiAnim_VisualElementImpl.cpp b/src/ui/animations/FUiAnim_VisualElementImpl.cpp index ff4076c..a86708e 100644 --- a/src/ui/animations/FUiAnim_VisualElementImpl.cpp +++ b/src/ui/animations/FUiAnim_VisualElementImpl.cpp @@ -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) { -- 2.7.4