X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Ftext%2Ftext-visual.cpp;h=e97960771b1e29f0f2820d4f4529b73399187bdb;hb=refs%2Fchanges%2F84%2F155584%2F3;hp=360b9c149afcb8152a8c26bf91d2f2320afdc37f;hpb=eac074bfe3a3c144f55583135515d2c8d16eb479;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/text/text-visual.cpp b/dali-toolkit/internal/visuals/text/text-visual.cpp index 360b9c1..e979607 100755 --- a/dali-toolkit/internal/visuals/text/text-visual.cpp +++ b/dali-toolkit/internal/visuals/text/text-visual.cpp @@ -194,12 +194,11 @@ const char* FRAGMENT_SHADER_SINGLE_COLOR_TEXT_WITH_EMOJI = DALI_COMPOSE_SHADER( // Set the color of non-transparent pixel in text to what it is animated to. // Markup text with multiple text colors are not animated (but can be supported later on if required). // Emoji color are not animated. - mediump vec4 textColor = textTexture * textTexture.a;\n - mediump float vstep = step( 0.0001, textColor.a );\n - textColor.rgb = mix( textColor.rgb, uTextColorAnimatable.rgb, vstep * maskTexture );\n + mediump float vstep = step( 0.0001, textTexture.a );\n + textTexture.rgb = mix( textTexture.rgb, uTextColorAnimatable.rgb, vstep * maskTexture );\n // Draw the text as overlay above the style - gl_FragColor = textColor * uColor * vec4( mixColor, opacity );\n + gl_FragColor = textTexture * uColor * vec4( mixColor, opacity );\n }\n ); @@ -225,12 +224,11 @@ const char* FRAGMENT_SHADER_SINGLE_COLOR_TEXT_WITH_STYLE_AND_EMOJI = DALI_COMPOS // Set the color of non-transparent pixel in text to what it is animated to. // Markup text with multiple text colors are not animated (but can be supported later on if required). // Emoji color are not animated. - mediump vec4 textColor = textTexture * textTexture.a;\n - mediump float vstep = step( 0.0001, textColor.a );\n - textColor.rgb = mix( textColor.rgb, uTextColorAnimatable.rgb, vstep * maskTexture * ( 1.0 - uHasMultipleTextColors ) );\n + mediump float vstep = step( 0.0001, textTexture.a );\n + textTexture.rgb = mix( textTexture.rgb, uTextColorAnimatable.rgb, vstep * maskTexture * ( 1.0 - uHasMultipleTextColors ) );\n // Draw the text as overlay above the style - gl_FragColor = ( textColor + styleTexture * ( 1.0 - textTexture.a ) ) * uColor * vec4( mixColor, opacity );\n + gl_FragColor = ( textTexture + styleTexture * ( 1.0 - textTexture.a ) ) * uColor * vec4( mixColor, opacity );\n }\n ); @@ -513,18 +511,26 @@ void TextVisual::DoSetProperty( Dali::Property::Index index, const Dali::Propert } case Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT: { - Text::HorizontalAlignment::Type alignment( Toolkit::Text::HorizontalAlignment::BEGIN ); - Toolkit::Text::GetHorizontalAlignmentEnum( propertyValue, alignment ); - - mController->SetHorizontalAlignment( alignment ); + if( mController ) + { + Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set + if( Toolkit::Text::GetHorizontalAlignmentEnumeration( propertyValue, alignment ) ) + { + mController->SetHorizontalAlignment( alignment ); + } + } break; } case Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT: { - Text::VerticalAlignment::Type alignment( Toolkit::Text::VerticalAlignment::BOTTOM ); - Toolkit::Text::GetVerticalAlignmentEnum( propertyValue, alignment); - - mController->SetVerticalAlignment( alignment ); + if( mController ) + { + Toolkit::Text::VerticalAlignment::Type alignment( static_cast< Text::VerticalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set + if( Toolkit::Text::GetVerticalAlignmentEnumeration( propertyValue, alignment) ) + { + mController->SetVerticalAlignment( alignment ); + } + } break; } case Toolkit::TextVisual::Property::TEXT_COLOR: @@ -649,6 +655,7 @@ void TextVisual::UpdateRenderer() mImpl->mRenderer.RegisterProperty( "uHasMultipleTextColors", static_cast( hasMultipleTextColors ) ); mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON); + mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true ); //Register transform properties mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );