2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/event/common/stage-impl.h>
24 #include <cstring> // for strcmp
27 #include <dali/integration-api/system-overlay.h>
28 #include <dali/internal/event/actors/layer-impl.h>
29 #include <dali/internal/event/actors/layer-list.h>
30 #include <dali/internal/event/actors/camera-actor-impl.h>
31 #include <dali/internal/event/common/system-overlay-impl.h>
32 #include <dali/internal/event/common/thread-local-storage.h>
33 #include <dali/internal/event/common/property-notification-manager.h>
34 #include <dali/internal/event/render-tasks/render-task-list-impl.h>
35 #include <dali/internal/update/nodes/node.h>
36 #include <dali/internal/event/common/object-registry-impl.h>
37 #include <dali/integration-api/platform-abstraction.h>
38 #include <dali/public-api/common/constants.h>
39 #include <dali/public-api/events/touch-data.h>
40 #include <dali/public-api/object/type-registry.h>
41 #include <dali/public-api/render-tasks/render-task-list.h>
42 #include <dali/public-api/rendering/frame-buffer.h>
44 using Dali::Internal::SceneGraph::Node;
48 #if defined(DEBUG_ENABLED)
49 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_DEPTH_TIMER" );
62 const float DEFAULT_STEREO_BASE( 65.0f );
66 const char* const SIGNAL_KEY_EVENT = "keyEvent";
67 const char* const SIGNAL_KEY_EVENT_GENERATED = "keyEventGenerated";
68 const char* const SIGNAL_EVENT_PROCESSING_FINISHED = "eventProcessingFinished";
69 const char* const SIGNAL_TOUCHED = "touched";
70 const char* const SIGNAL_TOUCH = "touch";
71 const char* const SIGNAL_WHEEL_EVENT = "wheelEvent";
72 const char* const SIGNAL_CONTEXT_LOST = "contextLost";
73 const char* const SIGNAL_CONTEXT_REGAINED = "contextRegained";
74 const char* const SIGNAL_SCENE_CREATED = "sceneCreated";
76 TypeRegistration mType( typeid(Dali::Stage), typeid(Dali::BaseHandle), NULL );
78 SignalConnectorType signalConnector1( mType, SIGNAL_KEY_EVENT, &Stage::DoConnectSignal );
79 SignalConnectorType signalConnector2( mType, SIGNAL_EVENT_PROCESSING_FINISHED, &Stage::DoConnectSignal );
80 SignalConnectorType signalConnector3( mType, SIGNAL_TOUCHED, &Stage::DoConnectSignal );
81 SignalConnectorType signalConnector4( mType, SIGNAL_WHEEL_EVENT, &Stage::DoConnectSignal );
82 SignalConnectorType signalConnector5( mType, SIGNAL_CONTEXT_LOST, &Stage::DoConnectSignal );
83 SignalConnectorType signalConnector6( mType, SIGNAL_CONTEXT_REGAINED, &Stage::DoConnectSignal );
84 SignalConnectorType signalConnector7( mType, SIGNAL_SCENE_CREATED, &Stage::DoConnectSignal );
85 SignalConnectorType signalConnector8( mType, SIGNAL_KEY_EVENT_GENERATED, &Stage::DoConnectSignal );
86 SignalConnectorType signalConnector9( mType, SIGNAL_TOUCH, &Stage::DoConnectSignal );
88 } // unnamed namespace
90 StagePtr Stage::New( AnimationPlaylist& playlist,
91 PropertyNotificationManager& propertyNotificationManager,
92 SceneGraph::UpdateManager& updateManager,
93 NotificationManager& notificationManager,
94 Integration::RenderController& renderController )
96 return StagePtr( new Stage( playlist, propertyNotificationManager, updateManager, notificationManager, renderController ) );
99 void Stage::Initialize( bool renderToFbo )
101 mRenderToFbo = renderToFbo;
102 mObjectRegistry = ObjectRegistry::New();
104 // Create the ordered list of layers
105 mLayerList = LayerList::New( mUpdateManager );
107 // The stage owns the default layer
108 mRootLayer = Layer::NewRoot( *mLayerList, mUpdateManager );
109 mRootLayer->SetName("RootLayer");
110 // The root layer needs to have a fixed resize policy (as opposed to the default USE_NATURAL_SIZE).
111 // This stops actors parented to the stage having their relayout requests propagating
112 // up to the root layer, and down through other children unnecessarily.
113 mRootLayer->SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
115 // Create the default camera actor first; this is needed by the RenderTaskList
116 CreateDefaultCameraActor();
118 // Create the list of render-tasks
119 mRenderTaskList = RenderTaskList::New();
121 // Create the default render-task
122 Dali::RenderTask defaultRenderTask = mRenderTaskList->CreateTask( mRootLayer.Get(), mDefaultCamera.Get() );
125 void Stage::Uninitialize()
127 // Remove actors added to SystemOverlay
128 delete mSystemOverlay;
129 mSystemOverlay = NULL;
133 // its enough to release the handle so the object is released
134 // don't need to remove it from root actor as root actor will delete the object
135 mDefaultCamera.Reset();
140 // we are closing down so just delete the root, no point emit disconnect
141 // signals or send messages to update
145 if( mRenderTaskList )
147 mRenderTaskList.Reset();
151 StagePtr Stage::GetCurrent()
153 StagePtr stage( NULL );
154 // no checking in this version
155 ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
158 stage = tls->GetCurrentStage();
163 bool Stage::IsInstalled()
165 return ThreadLocalStorage::Created();
168 ObjectRegistry& Stage::GetObjectRegistry()
170 return *mObjectRegistry;
173 void Stage::RegisterObject( Dali::BaseObject* object )
175 mObjectRegistry->RegisterObject( object );
178 void Stage::UnregisterObject( Dali::BaseObject* object )
180 mObjectRegistry->UnregisterObject( object );
183 Layer& Stage::GetRootActor()
188 AnimationPlaylist& Stage::GetAnimationPlaylist()
190 return mAnimationPlaylist;
193 PropertyNotificationManager& Stage::GetPropertyNotificationManager()
195 return mPropertyNotificationManager;
198 void Stage::Add( Actor& actor )
200 mRootLayer->Add( actor );
203 void Stage::Remove( Actor& actor )
205 mRootLayer->Remove( actor );
208 void Stage::SurfaceResized( float width, float height )
210 if( ( fabsf( width - mSurfaceSize.width ) > Math::MACHINE_EPSILON_1000 ) || ( fabsf( height - mSurfaceSize.height ) > Math::MACHINE_EPSILON_1000 ) )
212 mSurfaceSize.width = width;
213 mSurfaceSize.height = height;
215 // Internally we want to report the actual size of the stage.
217 mSize.height = height - static_cast<float>( mTopMargin );
219 // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
220 mDefaultCamera->SetPerspectiveProjection( mSurfaceSize );
222 // Adjust the camera height to allow for top-margin
223 SetDefaultCameraPosition();
225 mRootLayer->SetSize( mSize.width, mSize.height );
227 // Repeat for SystemOverlay actors
230 // Note that the SystemOverlay has a separate camera, configured for the full surface-size.
231 // This will remain unaffected by changes in SetDefaultCameraPosition()
232 mSystemOverlay->GetImpl()->SetSize( width, height );
235 SetDefaultSurfaceRectMessage( mUpdateManager, Rect<int32_t>( 0, 0, static_cast<int32_t>( width ), static_cast<int32_t>( height ) ) ); // truncated
237 // if single render task to screen then set its viewport parameters
238 if( 1 == mRenderTaskList->GetTaskCount() )
240 Dali::RenderTask defaultRenderTask = mRenderTaskList->GetTask( 0u );
242 if(!defaultRenderTask.GetTargetFrameBuffer())
244 defaultRenderTask.SetViewport( Viewport( 0, 0, static_cast<int32_t>( width ), static_cast<int32_t>( height ) ) ); // truncated
250 Dali::FrameBuffer frameBuffer = Dali::FrameBuffer::New( static_cast<uint32_t>( width ), static_cast<uint32_t>( height ), Dali::FrameBuffer::Attachment::NONE );
251 Dali::Texture texture = Dali::Texture::New( Dali::TextureType::TEXTURE_2D, Dali::Pixel::RGB888, static_cast<uint32_t>( width ), static_cast<uint32_t>( height ) );
252 frameBuffer.AttachColorTexture( texture );
254 Dali::RenderTask defaultRenderTask = mRenderTaskList->GetTask( 0u );
255 defaultRenderTask.SetFrameBuffer( frameBuffer );
260 Vector2 Stage::GetSize() const
265 void Stage::SetTopMargin( uint32_t margin )
267 if (mTopMargin == margin)
273 mSize.width = mSurfaceSize.width;
274 mSize.height = mSurfaceSize.height - static_cast<float>( mTopMargin );
276 // Adjust the camera height to allow for top-margin
277 SetDefaultCameraPosition();
279 mRootLayer->SetSize( mSize.width, mSize.height );
282 RenderTaskList& Stage::GetRenderTaskList() const
284 return *mRenderTaskList;
287 void Stage::CreateDefaultCameraActor()
289 // The default camera attributes and position is such that
290 // children of the default layer, can be positioned at (0,0) and
291 // be at the top-left of the viewport.
292 mDefaultCamera = CameraActor::New( Size::ZERO );
293 mDefaultCamera->SetParentOrigin(ParentOrigin::CENTER);
294 Add(*(mDefaultCamera.Get()));
297 void Stage::SetDefaultCameraPosition()
299 mDefaultCamera->SetY( -(static_cast<float>(mTopMargin) * 0.5f) );
302 Actor& Stage::GetDefaultRootActor()
307 CameraActor& Stage::GetDefaultCameraActor()
309 return *mDefaultCamera;
312 uint32_t Stage::GetLayerCount() const
314 return mLayerList->GetLayerCount();
317 Dali::Layer Stage::GetLayer( uint32_t depth ) const
319 return Dali::Layer(mLayerList->GetLayer( depth ));
322 Dali::Layer Stage::GetRootLayer() const
324 return Dali::Layer( mRootLayer.Get() );
327 LayerList& Stage::GetLayerList()
332 Integration::SystemOverlay& Stage::GetSystemOverlay()
334 // Lazily create system-level if requested
335 if( !mSystemOverlay )
337 mSystemOverlay = new Integration::SystemOverlay( SystemOverlay::New( *this ) );
338 DALI_ASSERT_ALWAYS( NULL != mSystemOverlay && "Failed to create system overlay" );
340 mSystemOverlay->GetImpl()->SetSize( mSize.width, mSize.height );
343 return *mSystemOverlay;
346 SystemOverlay* Stage::GetSystemOverlayInternal()
348 SystemOverlay* overlay( NULL );
352 overlay = mSystemOverlay->GetImpl();
358 void Stage::SetViewMode( ViewMode viewMode )
360 if( mViewMode != viewMode )
362 DALI_LOG_INFO( Debug::Filter::gActor, Debug::Concise, "View mode changed from %d to %d\n", mViewMode, viewMode);
364 if( mViewMode == MONO )
366 mDefaultCamera->SetOrientation( Dali::ANGLE_180, Vector3::YAXIS );
367 mRenderTaskList->GetTask(0).SetSourceActor( Dali::Actor() );
369 //Create camera and RenderTask for left eye
370 mLeftCamera = CameraActor::New( Size::ZERO );
371 mLeftCamera->SetParentOrigin( ParentOrigin::CENTER );
372 mDefaultCamera->Add( *mLeftCamera.Get() );
373 mLeftRenderTask = mRenderTaskList->CreateTask();
374 mLeftRenderTask.SetCameraActor( Dali::CameraActor( mLeftCamera.Get() ) );
375 mLeftCamera->SetType( Dali::Camera::FREE_LOOK );
377 //Create camera and RenderTask for right eye
378 mRightCamera = CameraActor::New( Size::ZERO );
379 mRightCamera->SetParentOrigin( ParentOrigin::CENTER );
380 mDefaultCamera->Add( *mRightCamera.Get() );
381 mRightRenderTask = mRenderTaskList->CreateTask();
382 mRightRenderTask.SetClearColor( Vector4( 1.0f,0.0f,0.0f,1.0f));
384 mRightRenderTask.SetCameraActor( Dali::CameraActor( mRightCamera.Get() ) );
385 mRightCamera->SetType( Dali::Camera::FREE_LOOK );
389 mViewMode = viewMode;
395 // delete extra stereoscopic render tasks and cameras
396 mRenderTaskList->RemoveTask( mLeftRenderTask );
397 mDefaultCamera->Remove( *mLeftCamera.Get() );
398 mLeftRenderTask.Reset();
400 mRenderTaskList->RemoveTask( mRightRenderTask );
401 mDefaultCamera->Remove( *mRightCamera.Get() );
402 mRightRenderTask.Reset();
403 mRightCamera.Reset();
404 mDefaultCamera->SetOrientation( Dali::ANGLE_0, Vector3::YAXIS );
405 mDefaultCamera->SetType( Dali::Camera::LOOK_AT_TARGET );
406 mRenderTaskList->GetTask(0).SetSourceActor( Dali::Layer(mRootLayer.Get()) );
410 case STEREO_HORIZONTAL:
412 //Stereo mode with horizontal split is for landscape mode. That's the reason for the cameras being rotated
413 //Top camera renders the scene as seen from the right eye and bottom camera as seen from left.
415 //Calculate separation in pixels along vertical axis ( mStereoBase is defined in millimetres )
416 const float stereoBase( ( (mStereoBase / 25.4f) * GetDpi().y ) * 0.5f );
418 //Calculate aspect ratio
419 float aspect = mSize.width / (mSize.height * 0.5f);
421 mLeftCamera->SetPerspectiveProjection( mSize, Vector2( 0.0f,stereoBase) );
422 mLeftCamera->SetAspectRatio( aspect );
424 mLeftCamera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
425 mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
426 mLeftRenderTask.SetViewport( Viewport(0, static_cast<int32_t>( mSize.height * 0.5f ), static_cast<int32_t>( mSize.width ), static_cast<int32_t>( mSize.height * 0.5f ) ) ); // truncated
428 mRightCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, -stereoBase ) );
429 mRightCamera->SetAspectRatio( aspect );
430 mRightCamera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
431 mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
432 mRightRenderTask.SetViewport( Viewport(0, 0, static_cast<int32_t>( mSize.width ), static_cast<int32_t>( mSize.height * 0.5f ) ) ); // truncated
436 case STEREO_VERTICAL:
438 //Calculate separation in pixels along horizontal axis
439 const float stereoBase( ( (mStereoBase / 25.4f) * GetDpi().x ) * 0.5f );
441 //Recalculate fov based on viewport size
442 const float fov = 2.0f * std::atan( mSize.y / (2.0f * std::max( mSize.x*0.5f, mSize.y )) );
444 mLeftCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(stereoBase,0.0f) );
445 mLeftCamera->SetFieldOfView( fov );
446 mLeftCamera->SetOrientation( Dali::ANGLE_0, Vector3::ZAXIS );
447 mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
448 mLeftRenderTask.SetViewport( Viewport(0, 0, static_cast<int32_t>( mSize.width * 0.5f ), static_cast<int32_t>( mSize.height ) ) ); // truncated
450 mRightCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(-stereoBase,0.0f) );
451 mRightCamera->SetFieldOfView( fov );
452 mRightCamera->SetOrientation( Dali::ANGLE_0, Vector3::ZAXIS );
453 mRightCamera->SetPosition( Vector3( -stereoBase, 0.0f, 0.0f ) );
454 mRightRenderTask.SetViewport( Viewport( static_cast<int32_t>( mSize.width * 0.5f ), 0, static_cast<int32_t>( mSize.width * 0.5f ), static_cast<int32_t>( mSize.height ) ) ); // truncated
458 case STEREO_INTERLACED:
466 ViewMode Stage::GetViewMode() const
471 void Stage::SetStereoBase( float stereoBase )
473 if( ! Equals( mStereoBase, stereoBase ) )
475 DALI_LOG_INFO( Debug::Filter::gActor, Debug::Concise, "old( %.2f) new(%.2f)\n", mStereoBase, stereoBase );
476 mStereoBase = stereoBase;
480 case STEREO_HORIZONTAL:
482 stereoBase = mStereoBase / 25.4f * GetDpi().y * 0.5f;
483 float aspect = mSize.width / (mSize.height * 0.5f);
485 mLeftCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, stereoBase) );
486 mLeftCamera->SetAspectRatio( aspect );
487 mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
489 mRightCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, -stereoBase) );
490 mRightCamera->SetAspectRatio( aspect );
491 mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
495 case STEREO_VERTICAL:
497 stereoBase = mStereoBase / 25.4f * GetDpi().x * 0.5f;
498 const float fov = 2.0f * std::atan( mSize.y / (2.0f * std::max( mSize.x*0.5f, mSize.y )) );
500 mLeftCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(stereoBase,0.0f) );
501 mLeftCamera->SetFieldOfView( fov );
502 mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
504 mRightCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(-stereoBase,0.0f) );
505 mRightCamera->SetFieldOfView( fov );
506 mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
516 float Stage::GetStereoBase() const
521 void Stage::SetBackgroundColor(Vector4 color)
523 // Cache for public GetBackgroundColor()
524 mBackgroundColor = color;
526 // Send message to change color in next frame
527 SetBackgroundColorMessage( mUpdateManager, color );
530 Vector4 Stage::GetBackgroundColor() const
532 return mBackgroundColor;
535 Vector2 Stage::GetDpi() const
540 void Stage::SetDpi(Vector2 dpi)
545 void Stage::KeepRendering( float durationSeconds )
547 // Send message to keep rendering
548 KeepRenderingMessage( mUpdateManager, durationSeconds );
551 void Stage::SetRenderingBehavior( DevelStage::Rendering renderingBehavior )
553 if( mRenderingBehavior != renderingBehavior )
555 // Send message to change the rendering behavior
556 SetRenderingBehaviorMessage( mUpdateManager, renderingBehavior );
558 mRenderingBehavior = renderingBehavior;
562 DevelStage::Rendering Stage::GetRenderingBehavior() const
564 return mRenderingBehavior;
567 bool Stage::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
569 bool connected( true );
570 Stage* stage = static_cast< Stage* >(object); // TypeRegistry guarantees that this is the correct type.
572 if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
574 stage->KeyEventSignal().Connect( tracker, functor );
576 else if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT_GENERATED ) )
578 stage->KeyEventGeneratedSignal().Connect( tracker, functor );
580 else if( 0 == strcmp( signalName.c_str(), SIGNAL_EVENT_PROCESSING_FINISHED ) )
582 stage->EventProcessingFinishedSignal().Connect( tracker, functor );
584 else if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCHED ) )
586 stage->TouchedSignal().Connect( tracker, functor );
588 else if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCH ) )
590 stage->TouchSignal().Connect( tracker, functor );
592 else if( 0 == strcmp( signalName.c_str(), SIGNAL_WHEEL_EVENT ) )
594 stage->WheelEventSignal().Connect( tracker, functor );
596 else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_LOST ) )
598 stage->ContextLostSignal().Connect( tracker, functor );
600 else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_REGAINED ) )
602 stage->ContextRegainedSignal().Connect( tracker, functor );
604 else if( 0 == strcmp( signalName.c_str(), SIGNAL_SCENE_CREATED ) )
606 stage->SceneCreatedSignal().Connect( tracker, functor );
610 // signalName does not match any signal
617 void Stage::EmitKeyEventSignal(const KeyEvent& event)
619 // Emit the key event signal when no actor in the stage has gained the key input focus
621 mKeyEventSignal.Emit( event );
624 bool Stage::EmitKeyEventGeneratedSignal(const KeyEvent& event)
626 // Emit the KeyEventGenerated signal when KeyEvent is generated
628 return mKeyEventGeneratedSignal.Emit( event );
631 void Stage::EmitEventProcessingFinishedSignal()
633 mEventProcessingFinishedSignal.Emit();
636 void Stage::EmitTouchedSignal( const TouchEvent& touchEvent, const Dali::TouchData& touch )
638 mTouchedSignal.Emit( touchEvent );
639 mTouchSignal.Emit( touch );
642 void Stage::EmitWheelEventSignal(const WheelEvent& event)
644 // Emit the wheel event signal when no actor in the stage has gained the wheel input focus
646 mWheelEventSignal.Emit( event );
649 void Stage::EmitSceneCreatedSignal()
651 mSceneCreatedSignal.Emit();
654 Dali::Stage::KeyEventSignalType& Stage::KeyEventSignal()
656 return mKeyEventSignal;
659 Dali::DevelStage::KeyEventGeneratedSignalType& Stage::KeyEventGeneratedSignal()
661 return mKeyEventGeneratedSignal;
664 void Stage::AddFrameCallback( FrameCallbackInterface& frameCallback, Actor& rootActor )
666 AddFrameCallbackMessage( mUpdateManager, frameCallback, rootActor.GetNode() );
669 void Stage::RemoveFrameCallback( FrameCallbackInterface& frameCallback )
671 RemoveFrameCallbackMessage( mUpdateManager, frameCallback );
674 Dali::Stage::EventProcessingFinishedSignalType& Stage::EventProcessingFinishedSignal()
676 return mEventProcessingFinishedSignal;
679 Dali::Stage::TouchedSignalType& Stage::TouchedSignal()
681 DALI_LOG_WARNING( "Deprecated. Use TouchSignal() instead.\n" );
682 return mTouchedSignal;
685 Dali::Stage::TouchSignalType& Stage::TouchSignal()
690 Dali::Stage::WheelEventSignalType& Stage::WheelEventSignal()
692 return mWheelEventSignal;
695 Dali::Stage::ContextStatusSignal& Stage::ContextLostSignal()
697 return mContextLostSignal;
700 Dali::Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
702 return mContextRegainedSignal;
705 Dali::Stage::SceneCreatedSignalType& Stage::SceneCreatedSignal()
707 return mSceneCreatedSignal;
710 void Stage::NotifyContextLost()
712 mContextLostSignal.Emit();
715 void Stage::NotifyContextRegained()
717 mContextRegainedSignal.Emit();
721 void Stage::RequestRebuildDepthTree()
723 DALI_LOG_INFO(gLogFilter, Debug::General, "RequestRebuildDepthTree()\n");
724 mDepthTreeDirty = true;
727 void Stage::RebuildDepthTree()
729 // If the depth tree needs rebuilding, do it in this frame only.
730 if( mDepthTreeDirty )
732 DALI_LOG_INFO(gLogFilter, Debug::Concise, "RebuildDepthTree() dirty:T\n");
734 ActorPtr actor( mRootLayer.Get() );
735 actor->RebuildDepthTree();
736 mDepthTreeDirty = false;
741 Stage::Stage( AnimationPlaylist& playlist,
742 PropertyNotificationManager& propertyNotificationManager,
743 SceneGraph::UpdateManager& updateManager,
744 NotificationManager& notificationManager,
745 Integration::RenderController& renderController )
746 : mAnimationPlaylist( playlist ),
747 mPropertyNotificationManager( propertyNotificationManager ),
748 mUpdateManager( updateManager ),
749 mNotificationManager( notificationManager ),
750 mRenderController( renderController ),
751 mSize( Vector2::ZERO ),
752 mSurfaceSize( Vector2::ZERO ),
753 mBackgroundColor( Dali::Stage::DEFAULT_BACKGROUND_COLOR ),
755 mStereoBase( DEFAULT_STEREO_BASE ),
757 mDpi( Vector2::ZERO ),
760 mSystemOverlay( NULL ),
762 mKeyEventGeneratedSignal(),
763 mEventProcessingFinishedSignal(),
767 mContextLostSignal(),
768 mContextRegainedSignal(),
769 mSceneCreatedSignal(),
770 mRenderingBehavior( DevelStage::Rendering::IF_REQUIRED ),
771 mDepthTreeDirty( false ),
772 mForceNextUpdate( false ),
773 mRenderToFbo( false )
777 SceneGraph::UpdateManager& Stage::GetUpdateManager()
779 return mUpdateManager;
782 Integration::RenderController& Stage::GetRenderController()
784 return mRenderController;
787 uint32_t* Stage::ReserveMessageSlot( uint32_t size, bool updateScene )
789 return mUpdateManager.ReserveMessageSlot( size, updateScene );
792 BufferIndex Stage::GetEventBufferIndex() const
794 return mUpdateManager.GetEventBufferIndex();
797 void Stage::ForceNextUpdate()
799 mForceNextUpdate = true;
802 bool Stage::IsNextUpdateForced()
804 bool nextUpdateForced = mForceNextUpdate;
805 mForceNextUpdate = false;
806 return nextUpdateForced;
811 delete mSystemOverlay;
813 mObjectRegistry.Reset();
816 } // namespace Internal