1 #ifndef DALI_INTERNAL_CORE_H
2 #define DALI_INTERNAL_CORE_H
5 * Copyright (c) 2017 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,
83 bool renderToFboEnabled );
91 * @copydoc Dali::Integration::Core::GetContextNotifier()
93 Integration::ContextNotifierInterface* GetContextNotifier();
96 * @copydoc Dali::Integration::Core::ContextCreated()
98 void ContextCreated();
101 * @copydoc Dali::Integration::Core::ContextDestroyed()
103 void ContextDestroyed();
106 * @copydoc Dali::Integration::Core::RecoverFromContextLoss()
108 void RecoverFromContextLoss();
111 * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int)
113 void SurfaceResized(unsigned int width, unsigned int height);
116 * @copydoc Dali::Integration::Core::SetTopMargin( unsigned int margin )
118 void SetTopMargin( unsigned int margin );
121 * @copydoc Dali::Integration::Core::SetDpi(unsigned int, unsigned int)
123 void SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical);
126 * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(unsigned int)
128 void SetMinimumFrameTimeInterval(unsigned int interval);
131 * @copydoc Dali::Integration::Core::Update()
133 void Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo );
136 * @copydoc Dali::Integration::Core::Render()
138 void Render( Integration::RenderStatus& status );
141 * @copydoc Dali::Integration::Core::SceneCreated()
146 * @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
148 void QueueEvent( const Integration::Event& event );
151 * @copydoc Dali::Integration::Core::ProcessEvents()
153 void ProcessEvents();
156 * @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
158 unsigned int GetMaximumUpdateCount() const;
161 * @copydoc Dali::Integration::Core::GetSystemOverlay()
163 Integration::SystemOverlay& GetSystemOverlay();
168 * @copydoc Dali::Integration::Core::SetViewMode()
170 void SetViewMode( ViewMode viewMode );
173 * @copydoc Dali::Integration::Core::GetViewMode()
175 ViewMode GetViewMode() const;
178 * @copydoc Dali::Integration::Core::SetStereoBase()
180 void SetStereoBase( float stereoBase );
183 * @copydoc Dali::Integration::Core::GetStereoBase()
185 float GetStereoBase() const;
187 private: // for use by ThreadLocalStorage
190 * Returns the current stage.
191 * @return A smart-pointer to the current stage.
193 StagePtr GetCurrentStage();
196 * Returns the platform abstraction.
197 * @return A reference to the platform abstraction.
199 Integration::PlatformAbstraction& GetPlatform();
202 * Returns the update manager.
203 * @return A reference to the update manager.
205 SceneGraph::UpdateManager& GetUpdateManager();
208 * Returns the render manager.
209 * @return A reference to the render manager.
211 SceneGraph::RenderManager& GetRenderManager();
214 * Returns the notification manager.
215 * @return A reference to the Notification Manager.
217 NotificationManager& GetNotificationManager();
220 * Returns the Shader factory
221 * @return A reference to the Shader binary factory.
223 ShaderFactory& GetShaderFactory();
226 * Returns the gesture event processor.
227 * @return A reference to the gesture event processor.
229 GestureEventProcessor& GetGestureEventProcessor();
232 * Return the relayout controller
233 * @Return Return a reference to the relayout controller
235 RelayoutController& GetRelayoutController();
240 * Undefined copy and assignment operators
242 Core(const Core& core); // No definition
243 Core& operator=(const Core& core); // No definition
246 * Create Thread local storage
248 void CreateThreadLocalStorage();
252 Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
253 Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
255 IntrusivePtr<Stage> mStage; ///< The current stage
256 AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
257 OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
258 IntrusivePtr< RelayoutController > mRelayoutController; ///< Size negotiation relayout controller
259 bool mProcessingEvent : 1; ///< True during ProcessEvents()
261 OwnerPointer<SceneGraph::RenderTaskProcessor> mRenderTaskProcessor; ///< Handles the processing of render tasks
262 OwnerPointer<SceneGraph::RenderManager> mRenderManager; ///< Render manager
263 OwnerPointer<SceneGraph::UpdateManager> mUpdateManager; ///< Update manager
264 OwnerPointer<SceneGraph::DiscardQueue> mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
265 OwnerPointer<ShaderFactory> mShaderFactory; ///< Shader resource factory
266 OwnerPointer<NotificationManager> mNotificationManager; ///< Notification manager
267 OwnerPointer<GestureEventProcessor> mGestureEventProcessor; ///< The gesture event processor
268 OwnerPointer<EventProcessor> mEventProcessor; ///< The event processor
270 friend class ThreadLocalStorage;
274 } // namespace Internal
278 #endif // DALI_INTERNAL_CORE_H