[dali_1.0.21] 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 Core* Core::New(RenderController& renderController, PlatformAbstraction& platformAbstraction,
38                 GlAbstraction& glAbstraction, GlSyncAbstraction& glSyncAbstraction, GestureManager& gestureManager, ResourcePolicy::DataRetention policy )
39 {
40   Core* instance = new Core;
41   instance->mImpl = new Internal::Core( renderController, platformAbstraction, glAbstraction, glSyncAbstraction, gestureManager, policy );
42
43   return instance;
44 }
45
46 Core::~Core()
47 {
48   delete mImpl;
49 }
50
51 ContextNotifierInterface* Core::GetContextNotifier()
52 {
53   return mImpl->GetContextNotifier();
54 }
55
56 // @todo Rename to ResetGlContext
57 void Core::ContextCreated()
58 {
59   mImpl->ContextCreated();
60 }
61
62 // @todo Replace with StopRendering that prevents RenderManager from rendering
63 // until we get ResetGLContext again, change ContextCreated to reset gpu buffer cache,
64 // gl texture id's
65 void Core::ContextDestroyed()
66 {
67   mImpl->ContextDestroyed();
68 }
69
70 void Core::RecoverFromContextLoss()
71 {
72   mImpl->RecoverFromContextLoss();
73 }
74
75 void Core::SurfaceResized(unsigned int width, unsigned int height)
76 {
77   mImpl->SurfaceResized(width, height);
78 }
79
80 void Core::SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical)
81 {
82   mImpl->SetDpi(dpiHorizontal, dpiVertical);
83 }
84
85 void Core::Suspend()
86 {
87   mImpl->Suspend();
88 }
89
90 void Core::Resume()
91 {
92   mImpl->Resume();
93 }
94
95 void Core::QueueEvent(const Event& event)
96 {
97   mImpl->QueueEvent(event);
98 }
99
100 void Core::ProcessEvents()
101 {
102   mImpl->ProcessEvents();
103 }
104
105 void Core::UpdateTouchData(const TouchData& touch)
106 {
107   mImpl->UpdateTouchData(touch);
108 }
109
110 unsigned int Core::GetMaximumUpdateCount() const
111 {
112   return mImpl->GetMaximumUpdateCount();
113 }
114
115 void Core::Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, UpdateStatus& status )
116 {
117   mImpl->Update( elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status );
118 }
119
120 void Core::Render( RenderStatus& status )
121 {
122   mImpl->Render( status );
123 }
124
125 SystemOverlay& Core::GetSystemOverlay()
126 {
127   return mImpl->GetSystemOverlay();
128 }
129
130 void Core::SetViewMode( ViewMode viewMode )
131 {
132   mImpl->SetViewMode( viewMode );
133 }
134
135 ViewMode Core::GetViewMode() const
136 {
137   return mImpl->GetViewMode();
138 }
139
140 void Core::SetStereoBase( float stereoBase )
141 {
142   mImpl->SetStereoBase( stereoBase );
143 }
144
145 float Core::GetStereoBase() const
146 {
147   return mImpl->GetStereoBase();
148 }
149
150 Core::Core()
151 : mImpl( NULL )
152 {
153 }
154
155 } // namespace Integration
156
157 } // namespace Dali