1 #ifndef DALI_INTERNAL_CORE_H
2 #define DALI_INTERNAL_CORE_H
5 * Copyright (c) 2018 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/common/dali-vector.h>
23 #include <dali/public-api/object/ref-object.h>
24 #include <dali/integration-api/context-notifier.h>
25 #include <dali/integration-api/core-enumerations.h>
26 #include <dali/internal/common/owner-pointer.h>
27 #include <dali/internal/event/animation/animation-playlist-declarations.h>
28 #include <dali/internal/event/common/stage-def.h>
29 #include <dali/integration-api/resource-policies.h>
37 class RenderController;
38 class PlatformAbstraction;
41 class GlSyncAbstraction;
52 class NotificationManager;
53 class AnimationPlaylist;
54 class PropertyNotificationManager;
56 class GestureEventProcessor;
59 class RelayoutController;
66 class RenderTaskProcessor;
70 * Internal class for Dali::Integration::Core
77 * Create and initialise a new Core instance
79 Core( Integration::RenderController& renderController,
80 Integration::PlatformAbstraction& platform,
81 Integration::GlAbstraction& glAbstraction,
82 Integration::GlSyncAbstraction& glSyncAbstraction,
83 Integration::GestureManager& gestureManager,
84 ResourcePolicy::DataRetention dataRetentionPolicy,
85 Integration::RenderToFrameBuffer renderToFboEnabled,
86 Integration::DepthBufferAvailable depthBufferAvailable,
87 Integration::StencilBufferAvailable stencilBufferAvailable );
95 * @copydoc Dali::Integration::Core::GetContextNotifier()
97 Integration::ContextNotifierInterface* GetContextNotifier();
100 * @copydoc Dali::Integration::Core::ContextCreated()
102 void ContextCreated();
105 * @copydoc Dali::Integration::Core::ContextDestroyed()
107 void ContextDestroyed();
110 * @copydoc Dali::Integration::Core::RecoverFromContextLoss()
112 void RecoverFromContextLoss();
115 * @copydoc Dali::Integration::Core::SurfaceResized(uint32_t, uint32_t)
117 void SurfaceResized(uint32_t width, uint32_t height);
120 * @copydoc Dali::Integration::Core::SetTopMargin( uint32_t margin )
122 void SetTopMargin( uint32_t margin );
125 * @copydoc Dali::Integration::Core::SetDpi(uint32_t, uint32_t)
127 void SetDpi(uint32_t dpiHorizontal, uint32_t dpiVertical);
130 * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(uint32_t)
132 void SetMinimumFrameTimeInterval(uint32_t interval);
135 * @copydoc Dali::Integration::Core::Update()
137 void Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo );
140 * @copydoc Dali::Integration::Core::Render()
142 void Render( Integration::RenderStatus& status, bool forceClear );
145 * @copydoc Dali::Integration::Core::SceneCreated()
150 * @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
152 void QueueEvent( const Integration::Event& event );
155 * @copydoc Dali::Integration::Core::ProcessEvents()
157 void ProcessEvents();
160 * @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
162 uint32_t GetMaximumUpdateCount() const;
165 * @copydoc Dali::Integration::Core::GetSystemOverlay()
167 Integration::SystemOverlay& GetSystemOverlay();
170 * @copydoc Dali::Integration::Core::RegisterProcessor
172 void RegisterProcessor( Dali::Integration::Processor& processor );
175 * @copydoc Dali::Integration::Core::UnregisterProcessor
177 void UnregisterProcessor( Dali::Integration::Processor& processor );
181 * Run each registered processor
183 void RunProcessors();
185 // for use by ThreadLocalStorage
188 * Returns the current stage.
189 * @return A smart-pointer to the current stage.
191 StagePtr GetCurrentStage();
194 * Returns the platform abstraction.
195 * @return A reference to the platform abstraction.
197 Integration::PlatformAbstraction& GetPlatform();
200 * Returns the update manager.
201 * @return A reference to the update manager.
203 SceneGraph::UpdateManager& GetUpdateManager();
206 * Returns the render manager.
207 * @return A reference to the render manager.
209 SceneGraph::RenderManager& GetRenderManager();
212 * Returns the notification manager.
213 * @return A reference to the Notification Manager.
215 NotificationManager& GetNotificationManager();
218 * Returns the Shader factory
219 * @return A reference to the Shader binary factory.
221 ShaderFactory& GetShaderFactory();
224 * Returns the gesture event processor.
225 * @return A reference to the gesture event processor.
227 GestureEventProcessor& GetGestureEventProcessor();
230 * Return the relayout controller
231 * @Return Return a reference to the relayout controller
233 RelayoutController& GetRelayoutController();
238 * Undefined copy and assignment operators
240 Core(const Core& core); // No definition
241 Core& operator=(const Core& core); // No definition
244 * Create Thread local storage
246 void CreateThreadLocalStorage();
250 Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
251 Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
253 IntrusivePtr<Stage> mStage; ///< The current stage
254 AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
255 OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
256 IntrusivePtr< RelayoutController > mRelayoutController; ///< Size negotiation relayout controller
257 bool mProcessingEvent : 1; ///< True during ProcessEvents()
259 OwnerPointer<SceneGraph::RenderTaskProcessor> mRenderTaskProcessor; ///< Handles the processing of render tasks
260 OwnerPointer<SceneGraph::RenderManager> mRenderManager; ///< Render manager
261 OwnerPointer<SceneGraph::UpdateManager> mUpdateManager; ///< Update manager
262 OwnerPointer<SceneGraph::DiscardQueue> mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
263 OwnerPointer<ShaderFactory> mShaderFactory; ///< Shader resource factory
264 OwnerPointer<NotificationManager> mNotificationManager; ///< Notification manager
265 OwnerPointer<GestureEventProcessor> mGestureEventProcessor; ///< The gesture event processor
266 OwnerPointer<EventProcessor> mEventProcessor; ///< The event processor
267 Dali::Vector<Integration::Processor*> mProcessors; ///< Registered processors (not owned)
269 friend class ThreadLocalStorage;
273 } // namespace Internal
277 #endif // DALI_INTERNAL_CORE_H