Do nothing if the same size is set to the stage. 69/157069/3
authorVictor Cebollada <v.cebollada@samsung.com>
Mon, 23 Oct 2017 08:14:35 +0000 (09:14 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Mon, 23 Oct 2017 13:49:00 +0000 (14:49 +0100)
* Every time the surface is resized the camera,
  the root layer the system overlay and the default
  render task are updated.

Change-Id: I9aebc544796ded5059661e885085d8ee50d11146
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
dali/internal/event/common/stage-impl.cpp

index 1cd7cf3..997bb3a 100644 (file)
@@ -197,44 +197,46 @@ void Stage::Remove( Actor& actor )
   mRootLayer->Remove( actor );
 }
 
-void Stage::SurfaceResized(float width, float height)
+void Stage::SurfaceResized( float width, float height )
 {
-  mSurfaceSize.width = width;
-  mSurfaceSize.height = height;
-
-  // Internally we want to report the actual size of the stage.
-  mSize.width = width;
-  mSize.height = height - mTopMargin;
+  if( ( fabs( width - mSurfaceSize.width ) > Math::MACHINE_EPSILON_1000 ) || ( fabs( height - mSurfaceSize.height ) > Math::MACHINE_EPSILON_1000 ) )
+  {
+    mSurfaceSize.width = width;
+    mSurfaceSize.height = height;
 
-  // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
-  mDefaultCamera->SetPerspectiveProjection( mSurfaceSize );
+    // Internally we want to report the actual size of the stage.
+    mSize.width = width;
+    mSize.height = height - mTopMargin;
 
-  // Adjust the camera height to allow for top-margin
-  SetDefaultCameraPosition();
+    // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
+    mDefaultCamera->SetPerspectiveProjection( mSurfaceSize );
 
-  mRootLayer->SetSize( mSize.width, mSize.height );
+    // Adjust the camera height to allow for top-margin
+    SetDefaultCameraPosition();
 
-  // Repeat for SystemOverlay actors
-  if( mSystemOverlay )
-  {
-    // Note that the SystemOverlay has a separate camera, configured for the full surface-size.
-    // This will remain unaffected by changes in SetDefaultCameraPosition()
-    mSystemOverlay->GetImpl()->SetSize( width, height );
-  }
+    mRootLayer->SetSize( mSize.width, mSize.height );
 
-  SetDefaultSurfaceRectMessage( mUpdateManager, Rect<int>( 0, 0, width, height ) );
+    // Repeat for SystemOverlay actors
+    if( mSystemOverlay )
+    {
+      // Note that the SystemOverlay has a separate camera, configured for the full surface-size.
+      // This will remain unaffected by changes in SetDefaultCameraPosition()
+      mSystemOverlay->GetImpl()->SetSize( width, height );
+    }
 
-  // if single render task to screen then set its viewport parameters
-  if( 1 == mRenderTaskList->GetTaskCount() )
-  {
-    Dali::RenderTask mDefaultRenderTask = mRenderTaskList->GetTask(0);
+    SetDefaultSurfaceRectMessage( mUpdateManager, Rect<int>( 0, 0, width, height ) );
 
-    if(!mDefaultRenderTask.GetTargetFrameBuffer())
+    // if single render task to screen then set its viewport parameters
+    if( 1 == mRenderTaskList->GetTaskCount() )
     {
-      mDefaultRenderTask.SetViewport( Viewport(0, 0, width, height) );
+      Dali::RenderTask mDefaultRenderTask = mRenderTaskList->GetTask( 0u );
+
+      if(!mDefaultRenderTask.GetTargetFrameBuffer())
+      {
+        mDefaultRenderTask.SetViewport( Viewport(0, 0, width, height) );
+      }
     }
   }
-
 }
 
 Vector2 Stage::GetSize() const