Merge "DALi Version 1.9.30" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-scroller.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 8fba9b5..6d0930b
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
 #include <dali-toolkit/internal/text/text-scroller.h>
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/common/stage.h>
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
@@ -272,7 +271,10 @@ void TextScroller::SetParameters( Actor scrollingTextActor, Renderer renderer, T
 
     // Reset to the original shader and texture before scrolling
     mRenderer.SetShader(mShader);
-    mRenderer.SetTextures( mTextureSet );
+    if( mTextureSet )
+    {
+      mRenderer.SetTextures( mTextureSet );
+    }
   }
 
   mShader = mRenderer.GetShader();
@@ -301,11 +303,11 @@ void TextScroller::SetParameters( Actor scrollingTextActor, Renderer renderer, T
 
   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;
@@ -336,9 +338,10 @@ 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 );
 
+  Shader shader = mRenderer.GetShader();
   mScrollAnimation = Animation::New( scrollDuration );
-  mScrollAnimation.AnimateTo( Property( scrollingTextActor, mScrollDeltaIndex ), scrollAmount, TimePeriod( mLoopDelay, scrollDuration ) );
-  mScrollAnimation.SetEndAction( Animation::Discard );
+  mScrollAnimation.AnimateTo( Property( shader, mScrollDeltaIndex ), scrollAmount, TimePeriod( mLoopDelay, scrollDuration ) );
+  mScrollAnimation.SetEndAction( Animation::DISCARD );
   mScrollAnimation.SetLoopCount( loopCount );
   mScrollAnimation.FinishedSignal().Connect( this, &TextScroller::AutoScrollAnimationFinished );
   mScrollAnimation.Play();