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;
56 class ResourceManager;
59 class RelayoutController;
66 class TextureCacheDispatcher;
67 class RenderTaskProcessor;
71 * Internal class for Dali::Integration::Core
78 * Create and initialise a new Core instance
80 Core( Integration::RenderController& renderController,
81 Integration::PlatformAbstraction& platform,
82 Integration::GlAbstraction& glAbstraction,
83 Integration::GlSyncAbstraction& glSyncAbstraction,
84 Integration::GestureManager& gestureManager,
85 ResourcePolicy::DataRetention dataRetentionPolicy );
93 * @copydoc Dali::Integration::Core::GetContextNotifier()
95 Integration::ContextNotifierInterface* GetContextNotifier();
98 * @copydoc Dali::Integration::Core::ContextCreated()
100 void ContextCreated();
103 * @copydoc Dali::Integration::Core::ContextDestroyed()
105 void ContextDestroyed();
108 * @copydoc Dali::Integration::Core::RecoverFromContextLoss()
110 void RecoverFromContextLoss();
113 * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int)
115 void SurfaceResized(unsigned int width, unsigned int height);
118 * @copydoc Dali::Integration::Core::SetTopMargin( unsigned int margin )
120 void SetTopMargin( unsigned int margin );
123 * @copydoc Dali::Integration::Core::SetDpi(unsigned int, unsigned int)
125 void SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical);
128 * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(unsigned int)
130 void SetMinimumFrameTimeInterval(unsigned int interval);
133 * @copydoc Dali::Integration::Core::Update()
135 void Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status );
138 * @copydoc Dali::Integration::Core::Render()
140 void Render( Integration::RenderStatus& status );
143 * @copydoc Dali::Integration::Core::Suspend()
148 * @copydoc Dali::Integration::Core::Resume()
153 * @copydoc Dali::Integration::Core::SceneCreated()
158 * @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
160 void QueueEvent( const Integration::Event& event );
163 * @copydoc Dali::Integration::Core::ProcessEvents()
165 void ProcessEvents();
168 * @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
170 unsigned int GetMaximumUpdateCount() const;
173 * @copydoc Dali::Integration::Core::GetSystemOverlay()
175 Integration::SystemOverlay& GetSystemOverlay();
180 * @copydoc Dali::Integration::Core::SetViewMode()
182 void SetViewMode( ViewMode viewMode );
185 * @copydoc Dali::Integration::Core::GetViewMode()
187 ViewMode GetViewMode() const;
190 * @copydoc Dali::Integration::Core::SetStereoBase()
192 void SetStereoBase( float stereoBase );
195 * @copydoc Dali::Integration::Core::GetStereoBase()
197 float GetStereoBase() const;
199 private: // for use by ThreadLocalStorage
202 * Returns the current stage.
203 * @return A smart-pointer to the current stage.
205 StagePtr GetCurrentStage();
208 * Returns the platform abstraction.
209 * @return A reference to the platform abstraction.
211 Integration::PlatformAbstraction& GetPlatform();
214 * Returns the update manager.
215 * @return A reference to the update manager.
217 SceneGraph::UpdateManager& GetUpdateManager();
220 * Returns the render manager.
221 * @return A reference to the render manager.
223 SceneGraph::RenderManager& GetRenderManager();
226 * Returns the notification manager.
227 * @return A reference to the Notification Manager.
229 NotificationManager& GetNotificationManager();
232 * Returns the Resource Manager.
233 * @return A reference to the Resource Manager.
235 ResourceManager& GetResourceManager();
238 * Returns the Shader factory
239 * @return A reference to the Shader binary factory.
241 ShaderFactory& GetShaderFactory();
244 * Returns the gesture event processor.
245 * @return A reference to the gesture event processor.
247 GestureEventProcessor& GetGestureEventProcessor();
250 * Return the relayout controller
251 * @Return Return a reference to the relayout controller
253 RelayoutController& GetRelayoutController();
258 * Undefined copy and assignment operators
260 Core(const Core& core); // No definition
261 Core& operator=(const Core& core); // No definition
264 * Create Thread local storage
266 void CreateThreadLocalStorage();
270 Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
271 Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
273 IntrusivePtr<Stage> mStage; ///< The current stage
274 GestureEventProcessor* mGestureEventProcessor; ///< The gesture event processor
275 EventProcessor* mEventProcessor; ///< The event processor
276 SceneGraph::UpdateManager* mUpdateManager; ///< Update manager
277 SceneGraph::RenderManager* mRenderManager; ///< Render manager
278 SceneGraph::DiscardQueue* mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
279 SceneGraph::TextureCacheDispatcher* mTextureCacheDispatcher; ///< Used to send messages to TextureCache
280 LockedResourceQueue* mTextureUploadedQueue; ///< Stores resource ids which require post processing after render
281 NotificationManager* mNotificationManager; ///< Notification manager
282 AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
283 OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
284 ShaderFactory* mShaderFactory; ///< Shader resource factory
285 ResourceManager* mResourceManager; ///< Asynchronous Resource Loading
286 IntrusivePtr< RelayoutController > mRelayoutController; ///< Size negotiation relayout controller
287 SceneGraph::RenderTaskProcessor* mRenderTaskProcessor; ///< Handles the processing of render tasks
288 bool mIsActive : 1; ///< Whether Core is active or suspended
289 bool mProcessingEvent : 1; ///< True during ProcessEvents()
291 friend class ThreadLocalStorage;
295 } // namespace Internal
299 #endif // DALI_INTERNAL_CORE_H