Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / integration-api / core.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 // CLASS HEADER
18 #include <dali/integration-api/core.h>
19
20 // EXTERNAL INCLUDES
21 #include <iostream>
22 #include <stdarg.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/common/dali-common.h>
26 #include <dali/integration-api/events/event.h>
27 #include <dali/integration-api/gl-sync-abstraction.h>
28 #include <dali/internal/common/core-impl.h>
29
30 namespace Dali
31 {
32
33 namespace Integration
34 {
35
36 namespace KeepUpdating
37 {
38
39 const unsigned int NOT_REQUESTED = 0x00; ///< Zero means that no further updates are required
40
41 // Bit-field values
42 const unsigned int STAGE_KEEP_RENDERING   = 0x01;  ///< Stage::KeepRendering() is being used
43 const unsigned int INCOMING_MESSAGES      = 0x02;  ///< Event-thread is sending messages to update-thread
44 const unsigned int ANIMATIONS_RUNNING     = 0x04;  ///< Animations are ongoing
45 const unsigned int DYNAMICS_CHANGED       = 0x08;  ///< A dynamics simulation is running
46 const unsigned int LOADING_RESOURCES      = 0x10;  ///< Resources are being loaded
47 const unsigned int NOTIFICATIONS_PENDING  = 0x20;  ///< Notifications are pending for the event-thread
48 const unsigned int MONITORING_PERFORMANCE = 0x40;  ///< The --enable-performance-monitor option is being used
49 const unsigned int RENDER_TASK_SYNC       = 0x80;  ///< The refresh once render task is waiting for render sync
50
51 } // namespace KeepUpdating
52
53 Core* Core::New(RenderController& renderController, PlatformAbstraction& platformAbstraction,
54                 GlAbstraction& glAbstraction, GlSyncAbstraction& glSyncAbstraction, GestureManager& gestureManager)
55 {
56   Core* instance = new Core;
57   instance->mImpl = new Internal::Core( renderController, platformAbstraction, glAbstraction, glSyncAbstraction, gestureManager );
58
59   return instance;
60 }
61
62 Core::~Core()
63 {
64   delete mImpl;
65 }
66
67 void Core::ContextCreated()
68 {
69   mImpl->ContextCreated();
70 }
71
72 void Core::ContextToBeDestroyed()
73 {
74   mImpl->ContextToBeDestroyed();
75 }
76
77 void Core::SurfaceResized(unsigned int width, unsigned int height)
78 {
79   mImpl->SurfaceResized(width, height);
80 }
81
82 void Core::SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical)
83 {
84   mImpl->SetDpi(dpiHorizontal, dpiVertical);
85 }
86
87 void Core::SetMinimumFrameTimeInterval(unsigned int interval)
88 {
89   mImpl->SetMinimumFrameTimeInterval(interval);
90 }
91
92 void Core::Suspend()
93 {
94   mImpl->Suspend();
95 }
96
97 void Core::Resume()
98 {
99   mImpl->Resume();
100 }
101
102 void Core::QueueEvent(const Event& event)
103 {
104   mImpl->QueueEvent(event);
105 }
106
107 void Core::ProcessEvents()
108 {
109   mImpl->ProcessEvents();
110 }
111
112 void Core::UpdateTouchData(const TouchData& touch)
113 {
114   mImpl->UpdateTouchData(touch);
115 }
116
117 unsigned int Core::GetMaximumUpdateCount() const
118 {
119   return mImpl->GetMaximumUpdateCount();
120 }
121
122 void Core::Update( UpdateStatus& status )
123 {
124   mImpl->Update( status );
125 }
126
127 void Core::Render( RenderStatus& status )
128 {
129   mImpl->Render( status );
130 }
131
132 void Core::Sleep()
133 {
134   mImpl->Sleep();
135 }
136
137 void Core::WakeUp()
138 {
139   mImpl->WakeUp();
140 }
141
142 void Core::VSync( unsigned int frameNumber, unsigned int seconds, unsigned int microseconds )
143 {
144   mImpl->VSync( frameNumber, seconds, microseconds );
145 }
146
147 SystemOverlay& Core::GetSystemOverlay()
148 {
149   return mImpl->GetSystemOverlay();
150 }
151
152 void Core::SetViewMode( ViewMode viewMode )
153 {
154   mImpl->SetViewMode( viewMode );
155 }
156
157 ViewMode Core::GetViewMode() const
158 {
159   return mImpl->GetViewMode();
160 }
161
162 void Core::SetStereoBase( float stereoBase )
163 {
164   mImpl->SetStereoBase( stereoBase );
165 }
166
167 float Core::GetStereoBase() const
168 {
169   return mImpl->GetStereoBase();
170 }
171
172 Core::Core()
173 : mImpl( NULL )
174 {
175 }
176
177 } // namespace Integration
178
179 } // namespace Dali