X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-scroller.cpp;h=d908d33733e03cabf8210985d19f2a27cd181b78;hb=70510385d88cfbd5c232117d8436ca74c523e172;hp=6ad85d4d1362c0af8dd88af2a8008d4bb6ad040b;hpb=62c1e3ee309dec283a9e5d1b9d56816262ae8fd3;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-scroller.cpp b/dali-toolkit/internal/text/text-scroller.cpp old mode 100644 new mode 100755 index 6ad85d4..d908d33 --- a/dali-toolkit/internal/text/text-scroller.cpp +++ b/dali-toolkit/internal/text/text-scroller.cpp @@ -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,11 +19,11 @@ #include // EXTERNAL INCLUDES -#include #include // INTERNAL INCLUDES #include +#include namespace Dali { @@ -40,56 +40,6 @@ namespace const int MINIMUM_SCROLL_SPEED = 1; // Speed should be set by Property system. -const char* VERTEX_SHADER_SCROLL = DALI_COMPOSE_SHADER( - attribute mediump vec2 aPosition;\n - varying highp vec2 vTexCoord;\n - uniform mediump vec3 uSize;\n - uniform mediump float uDelta;\n - uniform mediump vec2 uTextureSize;\n - uniform mediump float uGap;\n - uniform mediump float uHorizontalAlign;\n - uniform mediump float uVerticalAlign;\n - \n - uniform highp mat4 uMvpMatrix;\n - \n - //Visual size and offset - uniform mediump vec2 offset;\n - uniform mediump vec2 size;\n - uniform mediump vec4 offsetSizeMode;\n - uniform mediump vec2 origin;\n - uniform mediump vec2 anchorPoint;\n - - void main()\n - {\n - mediump vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy );\n - mediump vec2 visualSize = mix( uSize.xy * size, size, offsetSizeMode.zw );\n - \n - vTexCoord.x = ( uDelta + uHorizontalAlign * ( uTextureSize.x - visualSize.x - uGap ) + floor( aPosition.x * visualSize.x ) + 0.5 - uGap * 0.5 ) / uTextureSize.x + 0.5;\n - vTexCoord.y = ( uVerticalAlign * ( uTextureSize.y - visualSize.y ) + floor( aPosition.y * visualSize.y ) + 0.5 ) / ( uTextureSize.y ) + 0.5;\n - \n - mediump vec4 vertexPosition = vec4( floor( ( aPosition + anchorPoint ) * visualSize + ( visualOffset + origin ) * uSize.xy ), 0.0, 1.0 );\n - \n - gl_Position = uMvpMatrix * vertexPosition;\n - }\n -); - -const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( - varying highp vec2 vTexCoord;\n - uniform sampler2D sTexture;\n - uniform lowp vec4 uColor;\n - uniform lowp vec3 mixColor;\n - \n - void main()\n - {\n - if ( vTexCoord.y > 1.0 )\n - discard;\n - \n - mediump vec4 textTexture = texture2D( sTexture, vTexCoord );\n - \n - gl_FragColor = textTexture * uColor * vec4( mixColor, 1.0 ); - }\n -); - /** * @brief How the text should be aligned horizontally when scrolling the text. * @@ -272,14 +222,17 @@ 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(); mTextureSet = mRenderer.GetTextures(); // Set the shader and texture for scrolling - Shader shader = Shader::New( VERTEX_SHADER_SCROLL, FRAGMENT_SHADER, Shader::Hint::NONE ); + Shader shader = Shader::New( SHADER_TEXT_SCROLLER_SHADER_VERT, SHADER_TEXT_SCROLLER_SHADER_FRAG, Shader::Hint::NONE ); mRenderer.SetShader( shader ); mRenderer.SetTextures( textureSet ); @@ -339,7 +292,7 @@ void TextScroller::StartScrolling( Actor scrollingTextActor, float scrollAmount, Shader shader = mRenderer.GetShader(); mScrollAnimation = Animation::New( scrollDuration ); mScrollAnimation.AnimateTo( Property( shader, mScrollDeltaIndex ), scrollAmount, TimePeriod( mLoopDelay, scrollDuration ) ); - mScrollAnimation.SetEndAction( Animation::Discard ); + mScrollAnimation.SetEndAction( Animation::DISCARD ); mScrollAnimation.SetLoopCount( loopCount ); mScrollAnimation.FinishedSignal().Connect( this, &TextScroller::AutoScrollAnimationFinished ); mScrollAnimation.Play();