Fork for IVI: mesa fixing
[profile/ivi/uifw.git] / src / ui / animations / FUiAnim_DisplayContextImpl.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17
18 /**
19  * @file        FUiAnim_DisplayContextImpl.cpp
20  * @brief       This is the implementation file for DisplayContext class.
21  *
22  * This file contains implementation DisplayContext class.
23  */
24
25 #include <FBaseSysLog.h>
26 #include "FUiAnim_NativeLayer.h"
27 #include "FUiAnim_VisualElementImpl.h"
28 #include "FUiAnimDisplayContext.h"
29 #include "FUiAnim_DisplayContextImpl.h"
30
31 using namespace Tizen::Base;
32
33 namespace Tizen { namespace Ui { namespace Animations
34 {
35
36 _DisplayContextImpl::_DisplayContextImpl(const _NativeLayer& layer)
37         : _pPublicInstance(null)
38 {
39         __pLayer = const_cast<_NativeLayer*>(&layer);
40 }
41
42 _DisplayContextImpl::~_DisplayContextImpl(void)
43 {
44         _pPublicInstance = null;
45         __pLayer = null;
46 }
47
48 result
49 _DisplayContextImpl::SetPublicInstance(DisplayContext* pInstance)
50 {
51         _pPublicInstance = pInstance;
52         return E_SUCCESS;
53 }
54
55 DisplayContext*
56 _DisplayContextImpl::GetPublicInstance(void)
57 {
58         return _pPublicInstance;
59 }
60
61 result
62 _DisplayContextImpl::SetNativeLayer(const _NativeLayer& layer)
63 {
64         __pLayer = const_cast<_NativeLayer*>(&layer);
65
66         return E_SUCCESS;
67 }
68
69 _DisplayContextImpl*
70 _DisplayContextImpl::GetInstance(DisplayContext& displayContext)
71 {
72         return displayContext._pDisplayContextImpl;
73 }
74
75 const _DisplayContextImpl*
76 _DisplayContextImpl::GetInstance(const DisplayContext& displayContext)
77 {
78         return displayContext._pDisplayContextImpl;
79 }
80
81 DisplayContext*
82 _DisplayContextImpl::CreatePublicInstance(const _NativeLayer& layer)
83 {
84         DisplayContext* pContext = new (std::nothrow) DisplayContext();
85
86         SysTryReturn(NID_UI_ANIM, pContext, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
87
88         pContext->_pDisplayContextImpl = new (std::nothrow) _DisplayContextImpl(layer);
89
90         return pContext;
91 }
92
93 result
94 _DisplayContextImpl::DestroyPublicInstance(const DisplayContext& displayContext)
95 {
96         delete &displayContext;
97         return E_SUCCESS;
98 }
99
100
101 }}}