1 #ifndef DALI_INTERNAL_CORE_H
2 #define DALI_INTERNAL_CORE_H
5 * Copyright (c) 2016 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;
69 class GeometryBatcher;
70 class RenderTaskProcessor;
74 * Internal class for Dali::Integration::Core
81 * Create and initialise a new Core instance
83 Core( Integration::RenderController& renderController,
84 Integration::PlatformAbstraction& platform,
85 Integration::GlAbstraction& glAbstraction,
86 Integration::GlSyncAbstraction& glSyncAbstraction,
87 Integration::GestureManager& gestureManager,
88 ResourcePolicy::DataRetention dataRetentionPolicy );
96 * @copydoc Dali::Integration::Core::GetContextNotifier()
98 Integration::ContextNotifierInterface* GetContextNotifier();
101 * @copydoc Dali::Integration::Core::ContextCreated()
103 void ContextCreated();
106 * @copydoc Dali::Integration::Core::ContextDestroyed()
108 void ContextDestroyed();
111 * @copydoc Dali::Integration::Core::RecoverFromContextLoss()
113 void RecoverFromContextLoss();
116 * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int)
118 void SurfaceResized(unsigned int width, unsigned int height);
121 * @copydoc Dali::Integration::Core::SetTopMargin( unsigned int margin )
123 void SetTopMargin( unsigned int margin );
126 * @copydoc Dali::Integration::Core::SetDpi(unsigned int, unsigned int)
128 void SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical);
131 * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(unsigned int)
133 void SetMinimumFrameTimeInterval(unsigned int interval);
136 * @copydoc Dali::Integration::Core::Update()
138 void Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status );
141 * @copydoc Dali::Integration::Core::Render()
143 void Render( Integration::RenderStatus& status );
146 * @copydoc Dali::Integration::Core::Suspend()
151 * @copydoc Dali::Integration::Core::Resume()
156 * @copydoc Dali::Integration::Core::SceneCreated()
161 * @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
163 void QueueEvent( const Integration::Event& event );
166 * @copydoc Dali::Integration::Core::ProcessEvents()
168 void ProcessEvents();
171 * @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
173 unsigned int GetMaximumUpdateCount() const;
176 * @copydoc Dali::Integration::Core::GetSystemOverlay()
178 Integration::SystemOverlay& GetSystemOverlay();
183 * @copydoc Dali::Integration::Core::SetViewMode()
185 void SetViewMode( ViewMode viewMode );
188 * @copydoc Dali::Integration::Core::GetViewMode()
190 ViewMode GetViewMode() const;
193 * @copydoc Dali::Integration::Core::SetStereoBase()
195 void SetStereoBase( float stereoBase );
198 * @copydoc Dali::Integration::Core::GetStereoBase()
200 float GetStereoBase() const;
202 private: // for use by ThreadLocalStorage
205 * Returns the current stage.
206 * @return A smart-pointer to the current stage.
208 StagePtr GetCurrentStage();
211 * Returns the platform abstraction.
212 * @return A reference to the platform abstraction.
214 Integration::PlatformAbstraction& GetPlatform();
217 * Returns the update manager.
218 * @return A reference to the update manager.
220 SceneGraph::UpdateManager& GetUpdateManager();
223 * Returns the render manager.
224 * @return A reference to the render manager.
226 SceneGraph::RenderManager& GetRenderManager();
229 * Returns the notification manager.
230 * @return A reference to the Notification Manager.
232 NotificationManager& GetNotificationManager();
235 * Returns the Resource Manager.
236 * @return A reference to the Resource Manager.
238 ResourceManager& GetResourceManager();
241 * Returns the Resource client.
242 * @return A reference to the Resource Client.
244 ResourceClient& GetResourceClient();
247 * Returns the Image factory
248 * @return A reference to the Image factory.
250 ImageFactory& GetImageFactory();
253 * Returns the Shader factory
254 * @return A reference to the Shader binary factory.
256 ShaderFactory& GetShaderFactory();
259 * Returns the gesture event processor.
260 * @return A reference to the gesture event processor.
262 GestureEventProcessor& GetGestureEventProcessor();
265 * Return the relayout controller
266 * @Return Return a reference to the relayout controller
268 RelayoutController& GetRelayoutController();
273 * Undefined copy and assignment operators
275 Core(const Core& core); // No definition
276 Core& operator=(const Core& core); // No definition
279 * Create Thread local storage
281 void CreateThreadLocalStorage();
285 Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
286 Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
288 IntrusivePtr<Stage> mStage; ///< The current stage
289 GestureEventProcessor* mGestureEventProcessor; ///< The gesture event processor
290 EventProcessor* mEventProcessor; ///< The event processor
291 SceneGraph::UpdateManager* mUpdateManager; ///< Update manager
292 SceneGraph::RenderManager* mRenderManager; ///< Render manager
293 SceneGraph::DiscardQueue* mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
294 SceneGraph::TextureCacheDispatcher* mTextureCacheDispatcher; ///< Used to send messages to TextureCache
295 LockedResourceQueue* mTextureUploadedQueue; ///< Stores resource ids which require post processing after render
296 NotificationManager* mNotificationManager; ///< Notification manager
297 AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
298 OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
299 ImageFactory* mImageFactory; ///< Image resource factory
300 ShaderFactory* mShaderFactory; ///< Shader resource factory
301 ResourceClient* mResourceClient; ///< Asynchronous Resource Loading
302 ResourceManager* mResourceManager; ///< Asynchronous Resource Loading
303 IntrusivePtr< RelayoutController > mRelayoutController; ///< Size negotiation relayout controller
304 SceneGraph::GeometryBatcher* mGeometryBatcher; ///< Instance of the geometry batcher
305 SceneGraph::RenderTaskProcessor* mRenderTaskProcessor; ///< Handles the processing of render tasks
306 bool mIsActive : 1; ///< Whether Core is active or suspended
307 bool mProcessingEvent : 1; ///< True during ProcessEvents()
309 friend class ThreadLocalStorage;
313 } // namespace Internal
317 #endif // DALI_INTERNAL_CORE_H