[dali_1.2.15] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / dali / internal / event / common / stage-impl.cpp
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/event/common/stage-impl.h>
20
21 // EXTERNAL INCLUDES
22 #include <algorithm>
23 #include <cmath>
24 #include <cstring> // for strcmp
25
26 // INTERNAL INCLUDES
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
43 using Dali::Internal::SceneGraph::Node;
44
45 namespace Dali
46 {
47
48 namespace Internal
49 {
50
51 namespace
52 {
53
54 const float DEFAULT_STEREO_BASE( 65.0f );
55
56 // Signals
57
58 const char* const SIGNAL_KEY_EVENT =                 "keyEvent";
59 const char* const SIGNAL_EVENT_PROCESSING_FINISHED = "eventProcessingFinished";
60 const char* const SIGNAL_TOUCHED =                   "touched";
61 const char* const SIGNAL_WHEEL_EVENT =               "wheelEvent";
62 const char* const SIGNAL_CONTEXT_LOST =              "contextLost";
63 const char* const SIGNAL_CONTEXT_REGAINED =          "contextRegained";
64 const char* const SIGNAL_SCENE_CREATED =             "sceneCreated";
65
66 TypeRegistration mType( typeid(Dali::Stage), typeid(Dali::BaseHandle), NULL );
67
68 SignalConnectorType signalConnector1( mType, SIGNAL_KEY_EVENT,                 &Stage::DoConnectSignal );
69 SignalConnectorType signalConnector2( mType, SIGNAL_EVENT_PROCESSING_FINISHED, &Stage::DoConnectSignal );
70 SignalConnectorType signalConnector3( mType, SIGNAL_TOUCHED,                   &Stage::DoConnectSignal );
71 SignalConnectorType signalConnector4( mType, SIGNAL_WHEEL_EVENT,               &Stage::DoConnectSignal );
72 SignalConnectorType signalConnector5( mType, SIGNAL_CONTEXT_LOST,              &Stage::DoConnectSignal );
73 SignalConnectorType signalConnector6( mType, SIGNAL_CONTEXT_REGAINED,          &Stage::DoConnectSignal );
74 SignalConnectorType signalConnector7( mType, SIGNAL_SCENE_CREATED,             &Stage::DoConnectSignal );
75
76 } // unnamed namespace
77
78 StagePtr Stage::New( AnimationPlaylist& playlist,
79                      PropertyNotificationManager& propertyNotificationManager,
80                      SceneGraph::UpdateManager& updateManager,
81                      NotificationManager& notificationManager )
82 {
83   return StagePtr( new Stage( playlist, propertyNotificationManager, updateManager, notificationManager ) );
84 }
85
86 void Stage::Initialize()
87 {
88   mObjectRegistry = ObjectRegistry::New();
89
90   // Create the ordered list of layers
91   mLayerList = LayerList::New( mUpdateManager, false/*not system-level*/ );
92
93   // The stage owns the default layer
94   mRootLayer = Layer::NewRoot( *mLayerList, mUpdateManager, false/*not system-level*/ );
95   mRootLayer->SetName("RootLayer");
96   // The root layer needs to have a fixed resize policy (as opposed to the default USE_NATURAL_SIZE).
97   // This stops actors parented to the stage having their relayout requests propagating
98   // up to the root layer, and down through other children unnecessarily.
99   mRootLayer->SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
100
101   // Create the default camera actor first; this is needed by the RenderTaskList
102   CreateDefaultCameraActor();
103
104   // Create the list of render-tasks
105   mRenderTaskList = RenderTaskList::New( *this, *this, false/*not system-level*/ );
106
107   // Create the default render-task
108   Dali::RenderTask defaultRenderTask = mRenderTaskList->CreateTask();
109 }
110
111 void Stage::Uninitialize()
112 {
113   // Remove actors added to SystemOverlay
114   delete mSystemOverlay;
115   mSystemOverlay = NULL;
116
117   if( mDefaultCamera )
118   {
119     // its enough to release the handle so the object is released
120     // don't need to remove it from root actor as root actor will delete the object
121     mDefaultCamera.Reset();
122   }
123
124   if( mRootLayer )
125   {
126     // we are closing down so just delete the root, no point emit disconnect
127     // signals or send messages to update
128     mRootLayer.Reset();
129   }
130 }
131
132 StagePtr Stage::GetCurrent()
133 {
134   StagePtr stage( NULL );
135   // no checking in this version
136   ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
137   if( tls )
138   {
139     stage = tls->GetCurrentStage();
140   }
141   return stage;
142 }
143
144 bool Stage::IsInstalled()
145 {
146   return ThreadLocalStorage::Created();
147 }
148
149 ObjectRegistry& Stage::GetObjectRegistry()
150 {
151   return *mObjectRegistry;
152 }
153
154 void Stage::RegisterObject( Dali::BaseObject* object )
155 {
156   mObjectRegistry->RegisterObject( object );
157 }
158
159 void Stage::UnregisterObject( Dali::BaseObject* object )
160 {
161   mObjectRegistry->UnregisterObject( object );
162 }
163
164 Layer& Stage::GetRootActor()
165 {
166   return *mRootLayer;
167 }
168
169 AnimationPlaylist& Stage::GetAnimationPlaylist()
170 {
171   return mAnimationPlaylist;
172 }
173
174 PropertyNotificationManager& Stage::GetPropertyNotificationManager()
175 {
176   return mPropertyNotificationManager;
177 }
178
179 void Stage::Add( Actor& actor )
180 {
181   mRootLayer->Add( actor );
182 }
183
184 void Stage::Remove( Actor& actor )
185 {
186   mRootLayer->Remove( actor );
187 }
188
189 void Stage::SurfaceResized(float width, float height)
190 {
191   mSurfaceSize.width = width;
192   mSurfaceSize.height = height;
193
194   // Internally we want to report the actual size of the stage.
195   mSize.width = width;
196   mSize.height = height - mTopMargin;
197
198   // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
199   mDefaultCamera->SetPerspectiveProjection( mSurfaceSize );
200
201   // Adjust the camera height to allow for top-margin
202   SetDefaultCameraPosition();
203
204   mRootLayer->SetSize( mSize.width, mSize.height );
205
206   // Repeat for SystemOverlay actors
207   if( mSystemOverlay )
208   {
209     // Note that the SystemOverlay has a separate camera, configured for the full surface-size.
210     // This will remain unaffected by changes in SetDefaultCameraPosition()
211     mSystemOverlay->GetImpl()->SetSize( width, height );
212   }
213
214   SetDefaultSurfaceRectMessage( mUpdateManager, Rect<int>( 0, 0, width, height ) );
215
216   // if single render task to screen then set its viewport parameters
217   if( 1 == mRenderTaskList->GetTaskCount() )
218   {
219     Dali::RenderTask mDefaultRenderTask = mRenderTaskList->GetTask(0);
220
221     if(!mDefaultRenderTask.GetTargetFrameBuffer())
222     {
223       mDefaultRenderTask.SetViewport( Viewport(0, 0, width, height) );
224     }
225   }
226
227 }
228
229 Vector2 Stage::GetSize() const
230 {
231   return mSize;
232 }
233
234 void Stage::SetTopMargin( unsigned int margin )
235 {
236   if (mTopMargin == margin)
237   {
238     return;
239   }
240   mTopMargin = margin;
241
242   mSize.width = mSurfaceSize.width;
243   mSize.height = mSurfaceSize.height - mTopMargin;
244
245   // Adjust the camera height to allow for top-margin
246   SetDefaultCameraPosition();
247
248   mRootLayer->SetSize( mSize.width, mSize.height );
249 }
250
251 RenderTaskList& Stage::GetRenderTaskList() const
252 {
253   return *mRenderTaskList;
254 }
255
256 void Stage::CreateDefaultCameraActor()
257 {
258   // The default camera attributes and position is such that
259   // children of the default layer, can be positioned at (0,0) and
260   // be at the top-left of the viewport.
261   mDefaultCamera = CameraActor::New( Size::ZERO );
262   mDefaultCamera->SetParentOrigin(ParentOrigin::CENTER);
263   Add(*(mDefaultCamera.Get()));
264 }
265
266 void Stage::SetDefaultCameraPosition()
267 {
268   mDefaultCamera->SetY( -(static_cast<float>(mTopMargin) * 0.5f) );
269 }
270
271 Actor& Stage::GetDefaultRootActor()
272 {
273   return *mRootLayer;
274 }
275
276 CameraActor& Stage::GetDefaultCameraActor()
277 {
278   return *mDefaultCamera;
279 }
280
281 unsigned int Stage::GetLayerCount() const
282 {
283   return mLayerList->GetLayerCount();
284 }
285
286 Dali::Layer Stage::GetLayer( unsigned int depth ) const
287 {
288   return Dali::Layer(mLayerList->GetLayer( depth ));
289 }
290
291 Dali::Layer Stage::GetRootLayer() const
292 {
293   return Dali::Layer( mRootLayer.Get() );
294 }
295
296 LayerList& Stage::GetLayerList()
297 {
298   return *mLayerList;
299 }
300
301 Integration::SystemOverlay& Stage::GetSystemOverlay()
302 {
303   // Lazily create system-level if requested
304   if( !mSystemOverlay )
305   {
306     mSystemOverlay = new Integration::SystemOverlay( SystemOverlay::New( *this ) );
307     DALI_ASSERT_ALWAYS( NULL != mSystemOverlay && "Failed to create system overlay" );
308
309     mSystemOverlay->GetImpl()->SetSize( mSize.width, mSize.height );
310   }
311
312   return *mSystemOverlay;
313 }
314
315 SystemOverlay* Stage::GetSystemOverlayInternal()
316 {
317   SystemOverlay* overlay( NULL );
318
319   if( mSystemOverlay )
320   {
321     overlay = mSystemOverlay->GetImpl();
322   }
323
324   return overlay;
325 }
326
327 void Stage::SetViewMode( ViewMode viewMode )
328 {
329   if( mViewMode != viewMode )
330   {
331     DALI_LOG_INFO( Debug::Filter::gActor, Debug::Concise, "View mode changed from %d to %d\n", mViewMode, viewMode);
332
333     if( mViewMode == MONO )
334     {
335       mDefaultCamera->SetOrientation( Dali::ANGLE_180, Vector3::YAXIS );
336       mRenderTaskList->GetTask(0).SetSourceActor( Dali::Actor() );
337
338       //Create camera and RenderTask for left eye
339       mLeftCamera = CameraActor::New( Size::ZERO );
340       mLeftCamera->SetParentOrigin( ParentOrigin::CENTER );
341       mDefaultCamera->Add( *mLeftCamera.Get() );
342       mLeftRenderTask = mRenderTaskList->CreateTask();
343       mLeftRenderTask.SetCameraActor( Dali::CameraActor( mLeftCamera.Get() ) );
344       mLeftCamera->SetType( Dali::Camera::FREE_LOOK );
345
346       //Create camera and RenderTask for right eye
347       mRightCamera = CameraActor::New( Size::ZERO );
348       mRightCamera->SetParentOrigin( ParentOrigin::CENTER );
349       mDefaultCamera->Add( *mRightCamera.Get() );
350       mRightRenderTask = mRenderTaskList->CreateTask();
351       mRightRenderTask.SetClearColor( Vector4( 1.0f,0.0f,0.0f,1.0f));
352
353       mRightRenderTask.SetCameraActor( Dali::CameraActor( mRightCamera.Get() ) );
354       mRightCamera->SetType( Dali::Camera::FREE_LOOK );
355     }
356
357     // save new mode
358     mViewMode = viewMode;
359
360     switch( viewMode )
361     {
362       case MONO:
363       {
364         // delete extra stereoscopic render tasks and cameras
365         mRenderTaskList->RemoveTask( mLeftRenderTask );
366         mDefaultCamera->Remove( *mLeftCamera.Get() );
367         mLeftRenderTask.Reset();
368         mLeftCamera.Reset();
369         mRenderTaskList->RemoveTask( mRightRenderTask );
370         mDefaultCamera->Remove( *mRightCamera.Get() );
371         mRightRenderTask.Reset();
372         mRightCamera.Reset();
373         mDefaultCamera->SetOrientation( Dali::ANGLE_0, Vector3::YAXIS );
374         mDefaultCamera->SetType( Dali::Camera::LOOK_AT_TARGET );
375         mRenderTaskList->GetTask(0).SetSourceActor( Dali::Layer(mRootLayer.Get()) );
376
377         break;
378       }
379       case STEREO_HORIZONTAL:
380       {
381         //Stereo mode with horizontal split is for landscape mode. That's the reason for the cameras being rotated
382         //Top camera renders the scene as seen from the right eye and bottom camera as seen from left.
383
384         //Calculate separation in pixels along vertical axis ( mStereoBase is defined in millimetres )
385         const float stereoBase( ( (mStereoBase / 25.4f) * GetDpi().y ) * 0.5f );
386
387         //Calculate aspect ratio
388         float aspect = mSize.width / (mSize.height * 0.5f);
389
390         mLeftCamera->SetPerspectiveProjection( mSize, Vector2( 0.0f,stereoBase) );
391         mLeftCamera->SetAspectRatio( aspect );
392
393         mLeftCamera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
394         mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
395         mLeftRenderTask.SetViewport( Viewport(0, mSize.height * 0.5f, mSize.width, mSize.height * 0.5f) );
396
397         mRightCamera->SetPerspectiveProjection( mSize, Vector2( 0.0,  -stereoBase) );
398         mRightCamera->SetAspectRatio( aspect );
399         mRightCamera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
400         mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
401         mRightRenderTask.SetViewport( Viewport(0, 0, mSize.width, mSize.height * 0.5f ) );
402
403         break;
404       }
405       case STEREO_VERTICAL:
406       {
407         //Calculate separation in pixels along horizontal axis
408         const float stereoBase( ( (mStereoBase / 25.4f) * GetDpi().x ) * 0.5f );
409
410         //Recalculate fov based on viewport size
411         const float fov = 2.0f * std::atan(  mSize.y / (2.0f * std::max( mSize.x*0.5f, mSize.y )) );
412
413         mLeftCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(stereoBase,0.0f) );
414         mLeftCamera->SetFieldOfView( fov );
415         mLeftCamera->SetOrientation( Dali::ANGLE_0, Vector3::ZAXIS );
416         mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
417         mLeftRenderTask.SetViewport( Viewport(0, 0, mSize.width * 0.5f, mSize.height ) );
418
419         mRightCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(-stereoBase,0.0f) );
420         mRightCamera->SetFieldOfView( fov );
421         mRightCamera->SetOrientation( Dali::ANGLE_0, Vector3::ZAXIS );
422         mRightCamera->SetPosition( Vector3( -stereoBase, 0.0f, 0.0f ) );
423         mRightRenderTask.SetViewport( Viewport(mSize.width * 0.5f, 0, mSize.width * 0.5f, mSize.height ) );
424
425         break;
426       }
427       case STEREO_INTERLACED:
428       {
429         break;
430       }
431     }
432   }
433 }
434
435 ViewMode Stage::GetViewMode() const
436 {
437   return mViewMode;
438 }
439
440 void Stage::SetStereoBase( float stereoBase )
441 {
442   if( ! Equals( mStereoBase, stereoBase ) )
443   {
444     DALI_LOG_INFO( Debug::Filter::gActor, Debug::Concise, "old( %.2f) new(%.2f)\n", mStereoBase, stereoBase );
445     mStereoBase = stereoBase;
446
447     switch( mViewMode  )
448     {
449       case STEREO_HORIZONTAL:
450       {
451         stereoBase = mStereoBase / 25.4f * GetDpi().y * 0.5f;
452         float aspect = mSize.width / (mSize.height * 0.5f);
453
454         mLeftCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, stereoBase) );
455         mLeftCamera->SetAspectRatio( aspect );
456         mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
457
458         mRightCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, -stereoBase) );
459         mRightCamera->SetAspectRatio( aspect );
460         mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
461
462         break;
463       }
464       case STEREO_VERTICAL:
465       {
466         stereoBase = mStereoBase / 25.4f * GetDpi().x * 0.5f;
467         const float fov = 2.0f * std::atan(  mSize.y / (2.0f * std::max( mSize.x*0.5f, mSize.y )) );
468
469         mLeftCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(stereoBase,0.0f) );
470         mLeftCamera->SetFieldOfView( fov );
471         mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
472
473         mRightCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(-stereoBase,0.0f) );
474         mRightCamera->SetFieldOfView( fov );
475         mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
476
477         break;
478       }
479       default:
480         break;
481     }
482   }
483 }
484
485 float Stage::GetStereoBase() const
486 {
487   return mStereoBase;
488 }
489
490 void Stage::SetBackgroundColor(Vector4 color)
491 {
492   // Cache for public GetBackgroundColor()
493   mBackgroundColor = color;
494
495   // Send message to change color in next frame
496   SetBackgroundColorMessage( mUpdateManager, color );
497 }
498
499 Vector4 Stage::GetBackgroundColor() const
500 {
501   return mBackgroundColor;
502 }
503
504 Vector2 Stage::GetDpi() const
505 {
506   return mDpi;
507 }
508
509 void Stage::SetDpi(Vector2 dpi)
510 {
511   mDpi = dpi;
512 }
513
514 void Stage::KeepRendering( float durationSeconds )
515 {
516   // Send message to keep rendering
517   KeepRenderingMessage( mUpdateManager, durationSeconds );
518 }
519
520 bool Stage::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
521 {
522   bool connected( true );
523   Stage* stage = static_cast< Stage* >(object); // TypeRegistry guarantees that this is the correct type.
524
525   if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
526   {
527     stage->KeyEventSignal().Connect( tracker, functor );
528   }
529   else if( 0 == strcmp( signalName.c_str(), SIGNAL_EVENT_PROCESSING_FINISHED ) )
530   {
531     stage->EventProcessingFinishedSignal().Connect( tracker, functor );
532   }
533   else if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCHED ) )
534   {
535     stage->TouchedSignal().Connect( tracker, functor );
536   }
537   else if( 0 == strcmp( signalName.c_str(), SIGNAL_WHEEL_EVENT ) )
538   {
539     stage->WheelEventSignal().Connect( tracker, functor );
540   }
541   else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_LOST ) )
542   {
543     stage->ContextLostSignal().Connect( tracker, functor );
544   }
545   else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_REGAINED ) )
546   {
547     stage->ContextRegainedSignal().Connect( tracker, functor );
548   }
549   else if( 0 == strcmp( signalName.c_str(), SIGNAL_SCENE_CREATED ) )
550   {
551     stage->SceneCreatedSignal().Connect( tracker, functor );
552   }
553   else
554   {
555     // signalName does not match any signal
556     connected = false;
557   }
558
559   return connected;
560 }
561
562 void Stage::EmitKeyEventSignal(const KeyEvent& event)
563 {
564   // Emit the key event signal when no actor in the stage has gained the key input focus
565
566   mKeyEventSignal.Emit( event );
567 }
568
569 void Stage::EmitEventProcessingFinishedSignal()
570 {
571    mEventProcessingFinishedSignal.Emit();
572 }
573
574 void Stage::EmitTouchedSignal( const TouchEvent& touchEvent, const Dali::TouchData& touch )
575 {
576   mTouchedSignal.Emit( touchEvent );
577   mTouchSignal.Emit( touch );
578 }
579
580 void Stage::EmitWheelEventSignal(const WheelEvent& event)
581 {
582   // Emit the wheel event signal when no actor in the stage has gained the wheel input focus
583
584   mWheelEventSignal.Emit( event );
585 }
586
587 void Stage::EmitSceneCreatedSignal()
588 {
589   mSceneCreatedSignal.Emit();
590 }
591
592 Dali::Stage::KeyEventSignalType& Stage::KeyEventSignal()
593 {
594   return mKeyEventSignal;
595 }
596
597 Dali::Stage::EventProcessingFinishedSignalType& Stage::EventProcessingFinishedSignal()
598 {
599   return mEventProcessingFinishedSignal;
600 }
601
602 Dali::Stage::TouchedSignalType& Stage::TouchedSignal()
603 {
604   DALI_LOG_WARNING( "Deprecated. Use TouchSignal() instead.\n" );
605   return mTouchedSignal;
606 }
607
608 Dali::Stage::TouchSignalType& Stage::TouchSignal()
609 {
610   return mTouchSignal;
611 }
612
613 Dali::Stage::WheelEventSignalType& Stage::WheelEventSignal()
614 {
615   return mWheelEventSignal;
616 }
617
618 Dali::Stage::ContextStatusSignal& Stage::ContextLostSignal()
619 {
620   return mContextLostSignal;
621 }
622
623 Dali::Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
624 {
625   return mContextRegainedSignal;
626 }
627
628 Dali::Stage::SceneCreatedSignalType& Stage::SceneCreatedSignal()
629 {
630   return mSceneCreatedSignal;
631 }
632
633 void Stage::NotifyContextLost()
634 {
635   mContextLostSignal.Emit();
636 }
637
638 void Stage::NotifyContextRegained()
639 {
640   mContextRegainedSignal.Emit();
641 }
642
643 Stage::Stage( AnimationPlaylist& playlist,
644               PropertyNotificationManager& propertyNotificationManager,
645               SceneGraph::UpdateManager& updateManager,
646               NotificationManager& notificationManager )
647 : mAnimationPlaylist( playlist ),
648   mPropertyNotificationManager(propertyNotificationManager),
649   mUpdateManager(updateManager),
650   mNotificationManager(notificationManager),
651   mSize(Vector2::ZERO),
652   mBackgroundColor(Dali::Stage::DEFAULT_BACKGROUND_COLOR),
653   mViewMode( MONO ),
654   mStereoBase( DEFAULT_STEREO_BASE ),
655   mTopMargin( 0 ),
656   mSystemOverlay(NULL)
657 {
658 }
659
660 SceneGraph::UpdateManager& Stage::GetUpdateManager()
661 {
662   return mUpdateManager;
663 }
664
665 unsigned int* Stage::ReserveMessageSlot( std::size_t size, bool updateScene )
666 {
667   return mUpdateManager.ReserveMessageSlot( size, updateScene );
668 }
669
670 BufferIndex Stage::GetEventBufferIndex() const
671 {
672   return mUpdateManager.GetEventBufferIndex();
673 }
674
675 Stage::~Stage()
676 {
677   delete mSystemOverlay;
678
679   mObjectRegistry.Reset();
680 }
681
682 } // namespace Internal
683
684 } // namespace Dali