[dali_1.0.7] Merge branch 'tizen'
[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 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 // EXTERNAL INCLUDES
22 #include <iostream>
23 #include <stdarg.h>
24
25 // INTERNAL INCLUDES
26 #include <dali/public-api/common/dali-common.h>
27 #include <dali/integration-api/events/event.h>
28 #include <dali/integration-api/gl-sync-abstraction.h>
29 #include <dali/internal/common/core-impl.h>
30
31 namespace Dali
32 {
33
34 namespace Integration
35 {
36
37 namespace KeepUpdating
38 {
39
40 const unsigned int NOT_REQUESTED = 0x00; ///< Zero means that no further updates are required
41
42 // Bit-field values
43 const unsigned int STAGE_KEEP_RENDERING   = 0x01;  ///< Stage::KeepRendering() is being used
44 const unsigned int INCOMING_MESSAGES      = 0x02;  ///< Event-thread is sending messages to update-thread
45 const unsigned int ANIMATIONS_RUNNING     = 0x04;  ///< Animations are ongoing
46 const unsigned int DYNAMICS_CHANGED       = 0x08;  ///< A dynamics simulation is running
47 const unsigned int LOADING_RESOURCES      = 0x10;  ///< Resources are being loaded
48 const unsigned int NOTIFICATIONS_PENDING  = 0x20;  ///< Notifications are pending for the event-thread
49 const unsigned int MONITORING_PERFORMANCE = 0x40;  ///< The --enable-performance-monitor option is being used
50 const unsigned int RENDER_TASK_SYNC       = 0x80;  ///< The refresh once render task is waiting for render sync
51
52 } // namespace KeepUpdating
53
54 Core* Core::New(RenderController& renderController, PlatformAbstraction& platformAbstraction,
55                 GlAbstraction& glAbstraction, GlSyncAbstraction& glSyncAbstraction, GestureManager& gestureManager)
56 {
57   Core* instance = new Core;
58   instance->mImpl = new Internal::Core( renderController, platformAbstraction, glAbstraction, glSyncAbstraction, gestureManager );
59
60   return instance;
61 }
62
63 Core::~Core()
64 {
65   delete mImpl;
66 }
67
68 void Core::ContextCreated()
69 {
70   mImpl->ContextCreated();
71 }
72
73 void Core::ContextToBeDestroyed()
74 {
75   mImpl->ContextToBeDestroyed();
76 }
77
78 void Core::SurfaceResized(unsigned int width, unsigned int height)
79 {
80   mImpl->SurfaceResized(width, height);
81 }
82
83 void Core::SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical)
84 {
85   mImpl->SetDpi(dpiHorizontal, dpiVertical);
86 }
87
88 void Core::Suspend()
89 {
90   mImpl->Suspend();
91 }
92
93 void Core::Resume()
94 {
95   mImpl->Resume();
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 void Core::UpdateTouchData(const TouchData& touch)
109 {
110   mImpl->UpdateTouchData(touch);
111 }
112
113 unsigned int Core::GetMaximumUpdateCount() const
114 {
115   return mImpl->GetMaximumUpdateCount();
116 }
117
118 void Core::Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, UpdateStatus& status )
119 {
120   mImpl->Update( elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status );
121 }
122
123 void Core::Render( RenderStatus& status )
124 {
125   mImpl->Render( status );
126 }
127
128 SystemOverlay& Core::GetSystemOverlay()
129 {
130   return mImpl->GetSystemOverlay();
131 }
132
133 void Core::SetViewMode( ViewMode viewMode )
134 {
135   mImpl->SetViewMode( viewMode );
136 }
137
138 ViewMode Core::GetViewMode() const
139 {
140   return mImpl->GetViewMode();
141 }
142
143 void Core::SetStereoBase( float stereoBase )
144 {
145   mImpl->SetStereoBase( stereoBase );
146 }
147
148 float Core::GetStereoBase() const
149 {
150   return mImpl->GetStereoBase();
151 }
152
153 Core::Core()
154 : mImpl( NULL )
155 {
156 }
157
158 } // namespace Integration
159
160 } // namespace Dali