[4.0] Fix text color issue 90/183790/2 accepted/tizen/4.0/unified/20180712.142231 submit/tizen_4.0/20180711.031528
authorHeeyong Song <heeyong.song@samsung.com>
Wed, 11 Jul 2018 05:41:09 +0000 (14:41 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Wed, 11 Jul 2018 05:45:43 +0000 (05:45 +0000)
Alpha values are pre-multiplied in all text cases.
Don't multiply alpha in text shaders.

Change-Id: I0317639df758ead2e63146690872feacaecdb067

dali-toolkit/internal/visuals/text/text-visual.cpp

index 87f9366..4226dc3 100755 (executable)
@@ -139,7 +139,6 @@ const char* FRAGMENT_SHADER_MULTI_COLOR_TEXT = DALI_COMPOSE_SHADER(
   void main()\n
   {\n
     mediump vec4 textTexture = texture2D( sTexture, vTexCoord );\n
-    textTexture.rgb *= mix( 1.0, textTexture.a, preMultipliedAlpha );\n
 
     gl_FragColor = textTexture * uColor * visualMixColor();
   }\n
@@ -188,7 +187,6 @@ const char* FRAGMENT_SHADER_MULTI_COLOR_TEXT_WITH_STYLE = DALI_COMPOSE_SHADER(
   {\n
     mediump vec4 textTexture = texture2D( sTexture, vTexCoord );\n
     mediump vec4 styleTexture = texture2D( sStyle, vTexCoord );\n
-    textTexture.rgb *= mix( 1.0, textTexture.a, preMultipliedAlpha );\n
 
     // Draw the text as overlay above the style
     gl_FragColor = ( textTexture + styleTexture * ( 1.0 - textTexture.a ) ) * uColor * visualMixColor();\n
@@ -219,7 +217,7 @@ const char* FRAGMENT_SHADER_SINGLE_COLOR_TEXT_WITH_EMOJI = DALI_COMPOSE_SHADER(
     // Markup text with multiple text colors are not animated (but can be supported later on if required).
     // Emoji color are not animated.
     mediump float vstep = step( 0.0001, textTexture.a );\n
-    textTexture.rgb = mix( textTexture.rgb, uTextColorAnimatable.rgb, vstep * maskTexture ) * mix( 1.0, textTexture.a, preMultipliedAlpha );\n
+    textTexture.rgb = mix( textTexture.rgb, uTextColorAnimatable.rgb, vstep * maskTexture );\n
 
     // Draw the text as overlay above the style
     gl_FragColor = textTexture * uColor * visualMixColor();\n
@@ -253,7 +251,7 @@ const char* FRAGMENT_SHADER_SINGLE_COLOR_TEXT_WITH_STYLE_AND_EMOJI = DALI_COMPOS
     // Markup text with multiple text colors are not animated (but can be supported later on if required).
     // Emoji color are not animated.
     mediump float vstep = step( 0.0001, textTexture.a );\n
-    textTexture.rgb = mix( textTexture.rgb, uTextColorAnimatable.rgb, vstep * maskTexture * ( 1.0 - uHasMultipleTextColors ) ) * mix( 1.0, textTexture.a, preMultipliedAlpha );\n
+    textTexture.rgb = mix( textTexture.rgb, uTextColorAnimatable.rgb, vstep * maskTexture * ( 1.0 - uHasMultipleTextColors ) );\n
 
     // Draw the text as overlay above the style
     gl_FragColor = ( textTexture + styleTexture * ( 1.0 - textTexture.a ) ) * uColor * visualMixColor();\n