Fix text jitter issue 96/217796/2
authorHeeyong Song <heeyong.song@samsung.com>
Thu, 14 Nov 2019 08:21:25 +0000 (17:21 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Fri, 15 Nov 2019 01:34:14 +0000 (10:34 +0900)
Text jitter issue occurs when set a text again during text scrolling.
It is because the same property is used by the old and new animations. 2 PropertyResetters affect the same property.
So I've changed to use properties of Shader which is newly created every time.
Then the same property is not used by the old and new animation now.

Change-Id: I7ec9b266b0be48414d8df5e3ffead6e5c750b338

dali-toolkit/internal/text/text-scroller.cpp

index 8fba9b5..6ad85d4 100644 (file)
@@ -301,11 +301,11 @@ void TextScroller::SetParameters( Actor scrollingTextActor, Renderer renderer, T
 
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters horizontalAlign[%f], verticalAlign[%f]\n", horizontalAlign, verticalAlign );
 
 
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters horizontalAlign[%f], verticalAlign[%f]\n", horizontalAlign, verticalAlign );
 
-  scrollingTextActor.RegisterProperty( "uTextureSize", textureSize );
-  scrollingTextActor.RegisterProperty( "uHorizontalAlign", horizontalAlign );
-  scrollingTextActor.RegisterProperty( "uVerticalAlign", verticalAlign );
-  scrollingTextActor.RegisterProperty( "uGap", wrapGap );
-  mScrollDeltaIndex = scrollingTextActor.RegisterProperty( "uDelta", 0.0f );
+  shader.RegisterProperty( "uTextureSize", textureSize );
+  shader.RegisterProperty( "uHorizontalAlign", horizontalAlign );
+  shader.RegisterProperty( "uVerticalAlign", verticalAlign );
+  shader.RegisterProperty( "uGap", wrapGap );
+  mScrollDeltaIndex = shader.RegisterProperty( "uDelta", 0.0f );
 
   float scrollAmount = std::max( textureSize.width, controlSize.width );
   float scrollDuration =  scrollAmount / mScrollSpeed;
 
   float scrollAmount = std::max( textureSize.width, controlSize.width );
   float scrollDuration =  scrollAmount / mScrollSpeed;
@@ -336,8 +336,9 @@ void TextScroller::StartScrolling( Actor scrollingTextActor, float scrollAmount,
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::StartScrolling scrollAmount[%f] scrollDuration[%f], loop[%d] speed[%d]\n", scrollAmount, scrollDuration, loopCount, mScrollSpeed );
 
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::StartScrolling scrollAmount[%f] scrollDuration[%f], loop[%d] speed[%d]\n", scrollAmount, scrollDuration, loopCount, mScrollSpeed );
 
+  Shader shader = mRenderer.GetShader();
   mScrollAnimation = Animation::New( scrollDuration );
   mScrollAnimation = Animation::New( scrollDuration );
-  mScrollAnimation.AnimateTo( Property( scrollingTextActor, mScrollDeltaIndex ), scrollAmount, TimePeriod( mLoopDelay, scrollDuration ) );
+  mScrollAnimation.AnimateTo( Property( shader, mScrollDeltaIndex ), scrollAmount, TimePeriod( mLoopDelay, scrollDuration ) );
   mScrollAnimation.SetEndAction( Animation::Discard );
   mScrollAnimation.SetLoopCount( loopCount );
   mScrollAnimation.FinishedSignal().Connect( this, &TextScroller::AutoScrollAnimationFinished );
   mScrollAnimation.SetEndAction( Animation::Discard );
   mScrollAnimation.SetLoopCount( loopCount );
   mScrollAnimation.FinishedSignal().Connect( this, &TextScroller::AutoScrollAnimationFinished );