From: Adeel Kazmi Date: Mon, 16 May 2016 17:16:41 +0000 (+0100) Subject: Fix issues with text scrolling & transition effects using GetVectorXY() incorrectly X-Git-Tag: dali_1.1.35~7 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=1de7803f0c2e96a113b741f5090b4ad71159fdd9 Fix issues with text scrolling & transition effects using GetVectorXY() incorrectly Vector3::GetVectorXY() returns a ref (or a const ref). This is problematic in the files in this patch because they are returning a ref to a temporary variable which then goes out-of-scope later The fix is to just create a copy of the value on the stack rather than pass a ref to the temporary variable. Change-Id: I2e93748943487a677d394064b70c2b6afe983dbf --- diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index 6d46758..6a39ee7 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -681,8 +681,8 @@ void TextLabel::RenderText() void TextLabel::SetUpAutoScrolling() { - const Size& controlSize = mController->GetView().GetControlSize(); - const Size& offScreenSize = GetNaturalSize().GetVectorXY(); // As relayout of text may not be done at this point natural size is used to get size. Single line scrolling only. + const Size& controlSize = mController->GetView().GetControlSize(); // Needs to be a ref as the control-size can be changed by GetNaturalSize() + const Size offScreenSize = GetNaturalSize().GetVectorXY(); // As relayout of text may not be done at this point natural size is used to get size. Single line scrolling only. const Vector2& alignmentOffset = mController->GetAlignmentOffset(); const Text::CharacterDirection direction = mController->GetAutoScrollDirection(); diff --git a/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp b/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp index 10ffbff..3026d9c 100644 --- a/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp +++ b/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp @@ -105,8 +105,7 @@ void CubeTransitionCrossEffect::OnStartTransition( Vector2 panPosition, Vector2 } } - const Vector2& size = Self().GetCurrentSize().GetVectorXY(); - Vector2 halfSize = size * 0.5f; + const Vector2 halfSize = Self().GetCurrentSize().GetVectorXY() * 0.5f; //the centre to "explode" the tiles outwards from Vector3 centre( halfSize.x, halfSize.y, -1.0f / mDisplacementSpreadFactor ); @@ -130,7 +129,7 @@ void CubeTransitionCrossEffect::OnStartTransition( Vector2 panPosition, Vector2 void CubeTransitionCrossEffect::SetupAnimation( unsigned int actorIndex, unsigned int x, unsigned int y, float angle, const Vector3 axis, const Vector3& displacementCentre ) { - const Vector2& size = Self().GetCurrentSize().GetVectorXY(); + const Vector2 size = Self().GetCurrentSize().GetVectorXY(); Vector2 halfSize = size * 0.5f; //the position of the centre of the front face tile diff --git a/dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp b/dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp index d4ce91d..525a61e 100644 --- a/dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp +++ b/dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp @@ -109,7 +109,7 @@ void CubeTransitionWaveEffect::OnStartTransition( Vector2 panPosition, Vector2 p void CubeTransitionWaveEffect::CalculateSaddleSurfaceParameters( Vector2 position, Vector2 displacement ) { - const Vector2& size = Self().GetCurrentSize().GetVectorXY(); + const Vector2 size = Self().GetCurrentSize().GetVectorXY(); // the line passes through 'position' and has the direction of 'displacement' float coefA, coefB, coefC; //line equation: Ax+By+C=0; coefA = displacement.y;