1 #ifndef __DALI_INTERNAL_CORE_H__
2 #define __DALI_INTERNAL_CORE_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/ref-object.h>
23 #include <dali/integration-api/context-notifier.h>
24 #include <dali/internal/common/owner-pointer.h>
25 #include <dali/internal/event/animation/animation-playlist-declarations.h>
26 #include <dali/internal/event/common/stage-def.h>
27 #include <dali/internal/update/resources/resource-manager-declarations.h>
28 #include <dali/public-api/common/view-mode.h>
29 #include <dali/integration-api/resource-policies.h>
36 class RenderController;
37 class PlatformAbstraction;
40 class GlSyncAbstraction;
51 class NotificationManager;
52 class AnimationPlaylist;
53 class PropertyNotificationManager;
55 class GestureEventProcessor;
57 class ResourceManager;
61 class RelayoutController;
68 class TextureCacheDispatcher;
72 * Internal class for Dali::Integration::Core
79 * Create and initialise a new Core instance
81 Core( Integration::RenderController& renderController,
82 Integration::PlatformAbstraction& platform,
83 Integration::GlAbstraction& glAbstraction,
84 Integration::GlSyncAbstraction& glSyncAbstraction,
85 Integration::GestureManager& gestureManager,
86 ResourcePolicy::DataRetention dataRetentionPolicy );
94 * @copydoc Dali::Integration::Core::GetContextNotifier()
96 Integration::ContextNotifierInterface* GetContextNotifier();
99 * @copydoc Dali::Integration::Core::ContextCreated()
101 void ContextCreated();
104 * @copydoc Dali::Integration::Core::ContextDestroyed()
106 void ContextDestroyed();
109 * @copydoc Dali::Integration::Core::RecoverFromContextLoss()
111 void RecoverFromContextLoss();
114 * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int)
116 void SurfaceResized(unsigned int width, unsigned int height);
119 * @copydoc Dali::Integration::Core::SetDpi(unsigned int, unsigned int)
121 void SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical);
124 * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(unsigned int)
126 void SetMinimumFrameTimeInterval(unsigned int interval);
129 * @copydoc Dali::Integration::Core::Update()
131 void Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status );
134 * @copydoc Dali::Integration::Core::Render()
136 void Render( Integration::RenderStatus& status );
139 * @copydoc Dali::Integration::Core::Suspend()
144 * @copydoc Dali::Integration::Core::Resume()
149 * @copydoc Dali::Integration::Core::SceneCreated()
154 * @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
156 void QueueEvent( const Integration::Event& event );
159 * @copydoc Dali::Integration::Core::ProcessEvents()
161 void ProcessEvents();
164 * @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
166 unsigned int GetMaximumUpdateCount() const;
169 * @copydoc Dali::Integration::Core::GetSystemOverlay()
171 Integration::SystemOverlay& GetSystemOverlay();
176 * @copydoc Dali::Integration::Core::SetViewMode()
178 void SetViewMode( ViewMode viewMode );
181 * @copydoc Dali::Integration::Core::GetViewMode()
183 ViewMode GetViewMode() const;
186 * @copydoc Dali::Integration::Core::SetStereoBase()
188 void SetStereoBase( float stereoBase );
191 * @copydoc Dali::Integration::Core::GetStereoBase()
193 float GetStereoBase() const;
195 private: // for use by ThreadLocalStorage
198 * Returns the current stage.
199 * @return A smart-pointer to the current stage.
201 StagePtr GetCurrentStage();
204 * Returns the platform abstraction.
205 * @return A reference to the platform abstraction.
207 Integration::PlatformAbstraction& GetPlatform();
210 * Returns the update manager.
211 * @return A reference to the update manager.
213 SceneGraph::UpdateManager& GetUpdateManager();
216 * Returns the render manager.
217 * @return A reference to the render manager.
219 SceneGraph::RenderManager& GetRenderManager();
222 * Returns the notification manager.
223 * @return A reference to the Notification Manager.
225 NotificationManager& GetNotificationManager();
228 * Returns the Resource Manager.
229 * @return A reference to the Resource Manager.
231 ResourceManager& GetResourceManager();
234 * Returns the Resource client.
235 * @return A reference to the Resource Client.
237 ResourceClient& GetResourceClient();
240 * Returns the Image factory
241 * @return A reference to the Image factory.
243 ImageFactory& GetImageFactory();
246 * Returns the Shader factory
247 * @return A reference to the Shader binary factory.
249 ShaderFactory& GetShaderFactory();
252 * Returns the gesture event processor.
253 * @return A reference to the gesture event processor.
255 GestureEventProcessor& GetGestureEventProcessor();
258 * Return the relayout controller
259 * @Return Return a reference to the relayout controller
261 RelayoutController& GetRelayoutController();
266 * Undefined copy and assignment operators
268 Core(const Core& core); // No definition
269 Core& operator=(const Core& core); // No definition
272 * Create Thread local storage
274 void CreateThreadLocalStorage();
278 Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
279 Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
281 IntrusivePtr<Stage> mStage; ///< The current stage
282 GestureEventProcessor* mGestureEventProcessor; ///< The gesture event processor
283 EventProcessor* mEventProcessor; ///< The event processor
284 SceneGraph::UpdateManager* mUpdateManager; ///< Update manager
285 SceneGraph::RenderManager* mRenderManager; ///< Render manager
286 SceneGraph::DiscardQueue* mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
287 SceneGraph::TextureCacheDispatcher* mTextureCacheDispatcher; ///< Used to send messages to TextureCache
288 LockedResourceQueue* mTextureUploadedQueue; ///< Stores resource ids which require post processing after render
289 NotificationManager* mNotificationManager; ///< Notification manager
290 AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
291 OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
292 ImageFactory* mImageFactory; ///< Image resource factory
293 ShaderFactory* mShaderFactory; ///< Shader resource factory
294 ResourceClient* mResourceClient; ///< Asynchronous Resource Loading
295 ResourceManager* mResourceManager; ///< Asynchronous Resource Loading
296 IntrusivePtr< RelayoutController > mRelayoutController; ///< Size negotiation relayout controller
298 bool mIsActive : 1; ///< Whether Core is active or suspended
299 bool mProcessingEvent : 1; ///< True during ProcessEvents()
301 friend class ThreadLocalStorage;
305 } // namespace Internal
309 #endif // __DALI_INTERNAL_CORE_H__