dbe71ecf1a475e68639a0b72372ef7d92beb53a5
[platform/core/uifw/dali-core.git] / dali / integration-api / core.cpp
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/integration-api/core.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/integration-api/events/event.h>
24 #include <dali/integration-api/gl-sync-abstraction.h>
25 #include <dali/internal/common/core-impl.h>
26
27 namespace Dali
28 {
29
30 namespace Integration
31 {
32
33 Core* Core::New( RenderController& renderController,
34                  PlatformAbstraction& platformAbstraction,
35                  GlAbstraction& glAbstraction,
36                  GlSyncAbstraction& glSyncAbstraction,
37                  GestureManager& gestureManager,
38                  ResourcePolicy::DataRetention policy,
39                  bool renderToFboEnabled )
40 {
41   Core* instance = new Core;
42   instance->mImpl = new Internal::Core( renderController,
43                                         platformAbstraction,
44                                         glAbstraction,
45                                         glSyncAbstraction,
46                                         gestureManager,
47                                         policy,
48                                         renderToFboEnabled );
49
50   return instance;
51 }
52
53 Core::~Core()
54 {
55   delete mImpl;
56 }
57
58 ContextNotifierInterface* Core::GetContextNotifier()
59 {
60   return mImpl->GetContextNotifier();
61 }
62
63 void Core::ContextCreated()
64 {
65   mImpl->ContextCreated();
66 }
67
68 void Core::ContextDestroyed()
69 {
70   mImpl->ContextDestroyed();
71 }
72
73 void Core::RecoverFromContextLoss()
74 {
75   mImpl->RecoverFromContextLoss();
76 }
77
78 void Core::SurfaceResized(unsigned int width, unsigned int height)
79 {
80   mImpl->SurfaceResized(width, height);
81 }
82
83 void Core::SetTopMargin( unsigned int margin )
84 {
85   mImpl->SetTopMargin(margin);
86 }
87
88 void Core::SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical)
89 {
90   mImpl->SetDpi(dpiHorizontal, dpiVertical);
91 }
92
93 void Core::SceneCreated()
94 {
95   mImpl->SceneCreated();
96 }
97
98 void Core::QueueEvent(const Event& event)
99 {
100   mImpl->QueueEvent(event);
101 }
102
103 void Core::ProcessEvents()
104 {
105   mImpl->ProcessEvents();
106 }
107
108 unsigned int Core::GetMaximumUpdateCount() const
109 {
110   return mImpl->GetMaximumUpdateCount();
111 }
112
113   void Core::Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo )
114 {
115   mImpl->Update( elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status, renderToFboEnabled, isRenderingToFbo );
116 }
117
118 void Core::Render( RenderStatus& status )
119 {
120   mImpl->Render( status );
121 }
122
123 SystemOverlay& Core::GetSystemOverlay()
124 {
125   return mImpl->GetSystemOverlay();
126 }
127
128 void Core::SetViewMode( ViewMode viewMode )
129 {
130   mImpl->SetViewMode( viewMode );
131 }
132
133 ViewMode Core::GetViewMode() const
134 {
135   return mImpl->GetViewMode();
136 }
137
138 void Core::SetStereoBase( float stereoBase )
139 {
140   mImpl->SetStereoBase( stereoBase );
141 }
142
143 float Core::GetStereoBase() const
144 {
145   return mImpl->GetStereoBase();
146 }
147
148 Core::Core()
149 : mImpl( NULL )
150 {
151 }
152
153 } // namespace Integration
154
155 } // namespace Dali