2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiAnim_VisualElementSharedData.cpp
20 * @brief This file contains implementation of _VisualElementSharedData class
22 * This file contains implementation _VisualElementSharedData class.
25 #include <unique_ptr.h>
26 #include <FBaseSysLog.h>
27 #include <FBaseString.h>
28 #include <FUiAnimVisualElementSurface.h>
30 #include "FUiAnim_VisualElement.h"
31 #include "FUiAnim_VisualElementSharedData.h"
32 #include "FUiAnim_VisualElementSurfaceImpl.h"
33 #include "FUiAnim_INativeNode.h"
34 #include "FUiAnim_NativeLayer.h"
38 namespace Tizen { namespace Ui { namespace Animations
41 _VisualElementSharedData::_VisualElementSharedData(void)
42 : invalidatedNativeProps(-1)
43 , surfaceChanged(false)
46 , invalidatedRegion(0.0f, 0.0f, 0.0f, 0.0f)
47 , drawOnPresentation(false)
49 , redrawOnResize(false)
50 , isSurfaceOpaque(true)
51 , fixedSurfaceSize(false)
52 , invalidationLockCount(0)
53 , updateRegion(0.0f, 0.0f, 0.0f, 0.0f)
54 , pAnimationProvider(null)
55 , pContentProvider(null)
56 , pEventListener(null)
63 _VisualElementSharedData::~_VisualElementSharedData(void)
78 _VisualElementSharedData::Construct(void)
81 SysAssert(pNativeNode == null);
83 pNativeNode = _INativeNode::CreateInstanceN();
84 SysTryReturnResult(NID_UI, pNativeNode, E_OUT_OF_MEMORY, "Memory allocation failed.");
90 _VisualElementSharedData::AddRef(void)
96 _VisualElementSharedData::Release(void)
109 // error reference counting.........
113 _VisualElementSharedData::GetReferenceCount(void) const
119 _VisualElementSharedData::LockInvalidate(bool lock)
123 invalidationLockCount++;
125 else if (invalidationLockCount >= 1)
127 invalidationLockCount--;
132 _VisualElementSharedData::CreateSurface(const Tizen::Graphics::Dimension& size, _NativeLayer& layer)
134 unique_ptr<VisualElementSurface> pNewSurface(_VisualElementSurfaceImpl::CreateSurfaceN((const Handle)&layer, size));
135 SysTryReturnResult(NID_UI, pNewSurface, E_OUT_OF_MEMORY, "Memory allocation failed.");
143 pSurface = pNewSurface.release();
148 _VisualElementSharedData::SetImage(const Tizen::Base::String& fileName)
150 SysTryReturnResult(NID_UI, pNativeNode, E_INVALID_STATE, "The Native Node is invalid.");
151 SysTryReturnResult(NID_UI, pSurface, E_INVALID_STATE, "The Native Node is invalid.");
153 _VisualElementSurfaceImpl* pImpl = _VisualElementSurfaceImpl::GetInstance(*pSurface);
154 SysTryReturnResult(NID_UI, pImpl, E_SYSTEM, "A system error has been occurred.");
155 SysTryReturnResult(NID_UI, pImpl->SetImage(fileName) == E_SUCCESS, E_SYSTEM, "A system error has been occurred.");
161 _VisualElementSharedData::RemoveSurface(_VisualElementImpl& presentation)
163 if (likely(pNativeNode))
165 pNativeNode->Reconfigure(null, presentation, true);
172 }}} // Tizen::Ui::Animations