X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-scroller.cpp;h=f421cf7e32759714a57b531fdba5a93d240cbed1;hb=refs%2Fchanges%2F91%2F170491%2F7;hp=be837366fa78d6931aa17056d027837f68791895;hpb=cc06ca1ff697d568fde8de7a4d147fb9d9442fbc;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 index be83736..f421cf7 100644 --- a/dali-toolkit/internal/text/text-scroller.cpp +++ b/dali-toolkit/internal/text/text-scroller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -80,14 +80,8 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( uniform sampler2D sTexture;\n uniform lowp vec4 uColor;\n uniform lowp vec3 mixColor;\n - uniform lowp float opacity;\n uniform lowp float preMultipliedAlpha;\n \n - lowp vec4 visualMixColor()\n - {\n - return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n - }\n - \n void main()\n {\n if ( vTexCoord.y > 1.0 )\n @@ -96,7 +90,7 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( mediump vec4 textTexture = texture2D( sTexture, vTexCoord );\n textTexture.rgb *= mix( 1.0, textTexture.a, preMultipliedAlpha );\n \n - gl_FragColor = textTexture * uColor * visualMixColor(); + gl_FragColor = textTexture * uColor * vec4( mixColor, 1.0 ); }\n ); @@ -295,8 +289,20 @@ void TextScroller::SetParameters( Actor scrollingTextActor, Renderer renderer, T DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters wrapGap[%f]\n", wrapGap ); - const float horizontalAlign = HORIZONTAL_ALIGNMENT_TABLE[ horizontalAlignment ][ direction ]; + float horizontalAlign; + + if( textureSize.x > controlSize.x ) + { + // if Text is elided, scroll should start at the begin of text. + horizontalAlign = HORIZONTAL_ALIGNMENT_TABLE[HorizontalAlignment::BEGIN][ direction ]; + } + else + { + horizontalAlign = HORIZONTAL_ALIGNMENT_TABLE[ horizontalAlignment ][ direction ]; + } + const float verticalAlign = VERTICAL_ALIGNMENT_TABLE[ verticalAlignment ]; + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters horizontalAlign[%f], verticalAlign[%f]\n", horizontalAlign, verticalAlign ); scrollingTextActor.RegisterProperty( "uTextureSize", textureSize );