From: Victor Cebollada Date: Mon, 23 Oct 2017 08:14:35 +0000 (+0100) Subject: [4.0] Do nothing if the same size is set to the stage. X-Git-Tag: accepted/tizen/4.0/unified/20171121.061725~4^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-core.git;a=commitdiff_plain;h=14c7ac2264083abb4a8cd2d8e36d555ac6928315 [4.0] Do nothing if the same size is set to the stage. * 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 (cherry picked from commit fac1ab05d5ebbec145e8b34956c267768454f0f0) --- diff --git a/dali/internal/event/common/stage-impl.cpp b/dali/internal/event/common/stage-impl.cpp index 3fbdade..9e10b2e 100644 --- a/dali/internal/event/common/stage-impl.cpp +++ b/dali/internal/event/common/stage-impl.cpp @@ -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( 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( 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