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/public-api/common/view-mode.h>
28 #include <dali/integration-api/resource-policies.h>
35 class RenderController;
36 class PlatformAbstraction;
39 class GlSyncAbstraction;
50 class NotificationManager;
51 class AnimationPlaylist;
52 class PropertyNotificationManager;
54 class GestureEventProcessor;
57 class RelayoutController;
64 class RenderTaskProcessor;
68 * Internal class for Dali::Integration::Core
75 * Create and initialise a new Core instance
77 Core( Integration::RenderController& renderController,
78 Integration::PlatformAbstraction& platform,
79 Integration::GlAbstraction& glAbstraction,
80 Integration::GlSyncAbstraction& glSyncAbstraction,
81 Integration::GestureManager& gestureManager,
82 ResourcePolicy::DataRetention dataRetentionPolicy );
90 * @copydoc Dali::Integration::Core::GetContextNotifier()
92 Integration::ContextNotifierInterface* GetContextNotifier();
95 * @copydoc Dali::Integration::Core::ContextCreated()
97 void ContextCreated();
100 * @copydoc Dali::Integration::Core::ContextDestroyed()
102 void ContextDestroyed();
105 * @copydoc Dali::Integration::Core::RecoverFromContextLoss()
107 void RecoverFromContextLoss();
110 * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int)
112 void SurfaceResized(unsigned int width, unsigned int height);
115 * @copydoc Dali::Integration::Core::SetTopMargin( unsigned int margin )
117 void SetTopMargin( unsigned int margin );
120 * @copydoc Dali::Integration::Core::SetDpi(unsigned int, unsigned int)
122 void SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical);
125 * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(unsigned int)
127 void SetMinimumFrameTimeInterval(unsigned int interval);
130 * @copydoc Dali::Integration::Core::Update()
132 void Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status );
135 * @copydoc Dali::Integration::Core::Render()
137 void Render( Integration::RenderStatus& status );
140 * @copydoc Dali::Integration::Core::Suspend()
145 * @copydoc Dali::Integration::Core::Resume()
150 * @copydoc Dali::Integration::Core::SceneCreated()
155 * @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
157 void QueueEvent( const Integration::Event& event );
160 * @copydoc Dali::Integration::Core::ProcessEvents()
162 void ProcessEvents();
165 * @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
167 unsigned int GetMaximumUpdateCount() const;
170 * @copydoc Dali::Integration::Core::GetSystemOverlay()
172 Integration::SystemOverlay& GetSystemOverlay();
177 * @copydoc Dali::Integration::Core::SetViewMode()
179 void SetViewMode( ViewMode viewMode );
182 * @copydoc Dali::Integration::Core::GetViewMode()
184 ViewMode GetViewMode() const;
187 * @copydoc Dali::Integration::Core::SetStereoBase()
189 void SetStereoBase( float stereoBase );
192 * @copydoc Dali::Integration::Core::GetStereoBase()
194 float GetStereoBase() const;
196 private: // for use by ThreadLocalStorage
199 * Returns the current stage.
200 * @return A smart-pointer to the current stage.
202 StagePtr GetCurrentStage();
205 * Returns the platform abstraction.
206 * @return A reference to the platform abstraction.
208 Integration::PlatformAbstraction& GetPlatform();
211 * Returns the update manager.
212 * @return A reference to the update manager.
214 SceneGraph::UpdateManager& GetUpdateManager();
217 * Returns the render manager.
218 * @return A reference to the render manager.
220 SceneGraph::RenderManager& GetRenderManager();
223 * Returns the notification manager.
224 * @return A reference to the Notification Manager.
226 NotificationManager& GetNotificationManager();
229 * Returns the Shader factory
230 * @return A reference to the Shader binary factory.
232 ShaderFactory& GetShaderFactory();
235 * Returns the gesture event processor.
236 * @return A reference to the gesture event processor.
238 GestureEventProcessor& GetGestureEventProcessor();
241 * Return the relayout controller
242 * @Return Return a reference to the relayout controller
244 RelayoutController& GetRelayoutController();
249 * Undefined copy and assignment operators
251 Core(const Core& core); // No definition
252 Core& operator=(const Core& core); // No definition
255 * Create Thread local storage
257 void CreateThreadLocalStorage();
261 Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
262 Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
264 IntrusivePtr<Stage> mStage; ///< The current stage
265 GestureEventProcessor* mGestureEventProcessor; ///< The gesture event processor
266 EventProcessor* mEventProcessor; ///< The event processor
267 SceneGraph::UpdateManager* mUpdateManager; ///< Update manager
268 SceneGraph::RenderManager* mRenderManager; ///< Render manager
269 SceneGraph::DiscardQueue* mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
270 NotificationManager* mNotificationManager; ///< Notification manager
271 AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
272 OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
273 ShaderFactory* mShaderFactory; ///< Shader resource factory
274 IntrusivePtr< RelayoutController > mRelayoutController; ///< Size negotiation relayout controller
275 SceneGraph::RenderTaskProcessor* mRenderTaskProcessor; ///< Handles the processing of render tasks
276 bool mIsActive : 1; ///< Whether Core is active or suspended
277 bool mProcessingEvent : 1; ///< True during ProcessEvents()
279 friend class ThreadLocalStorage;
283 } // namespace Internal
287 #endif // DALI_INTERNAL_CORE_H