[4.0] Do nothing if the same size is set to the stage. 41/160541/1
authorVictor Cebollada <v.cebollada@samsung.com>
Mon, 23 Oct 2017 08:14:35 +0000 (09:14 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 16 Nov 2017 16:20:48 +0000 (16:20 +0000)
* 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>
(cherry picked from commit fac1ab05d5ebbec145e8b34956c267768454f0f0)

dali/internal/event/common/stage-impl.cpp

index 3fbdade..9e10b2e 100644 (file)
@@ -198,44 +198,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