uTextColorAnimatable property should always be registered.
Change-Id: I3ffbccc896f6abe4665a6f133b5be22df64df043
mController(Text::Controller::New()),
mTypesetter(Text::Typesetter::New(mController->GetTextModel())),
mAnimatableTextColorPropertyIndex(Property::INVALID_INDEX),
mController(Text::Controller::New()),
mTypesetter(Text::Typesetter::New(mController->GetTextModel())),
mAnimatableTextColorPropertyIndex(Property::INVALID_INDEX),
+ mTextColorAnimatableIndex(Property::INVALID_INDEX),
mRendererUpdateNeeded(false)
{
}
mRendererUpdateNeeded(false)
{
}
// Enable the pre-multiplied alpha to improve the text quality
EnablePreMultipliedAlpha(true);
// Enable the pre-multiplied alpha to improve the text quality
EnablePreMultipliedAlpha(true);
- if(mAnimatableTextColorPropertyIndex != Property::INVALID_INDEX)
+ const Vector4& defaultColor = mController->GetTextModel()->GetDefaultColor();
+ if(mTextColorAnimatableIndex == Property::INVALID_INDEX)
+ {
+ mTextColorAnimatableIndex = mImpl->mRenderer.RegisterProperty("uTextColorAnimatable", defaultColor);
+ }
+ else
- const Vector4& defaultColor = mController->GetTextModel()->GetDefaultColor();
- Dali::Property::Index shaderTextColorIndex = mImpl->mRenderer.RegisterProperty("uTextColorAnimatable", defaultColor);
+ mImpl->mRenderer.SetProperty(mTextColorAnimatableIndex, defaultColor);
+ }
+ if(mAnimatableTextColorPropertyIndex != Property::INVALID_INDEX)
+ {
// Create constraint for the animatable text's color Property with uTextColorAnimatable in the renderer.
// Create constraint for the animatable text's color Property with uTextColorAnimatable in the renderer.
- if(shaderTextColorIndex != Property::INVALID_INDEX)
+ if(mTextColorAnimatableIndex != Property::INVALID_INDEX)
{
if(!mColorConstraint)
{
{
if(!mColorConstraint)
{
- mColorConstraint = Constraint::New<Vector4>(mImpl->mRenderer, shaderTextColorIndex, TextColorConstraint);
+ mColorConstraint = Constraint::New<Vector4>(mImpl->mRenderer, mTextColorAnimatableIndex, TextColorConstraint);
mColorConstraint.AddSource(Source(actor, mAnimatableTextColorPropertyIndex));
}
mColorConstraint.Apply();
mColorConstraint.AddSource(Source(actor, mAnimatableTextColorPropertyIndex));
}
mColorConstraint.Apply();
- // Make zero if the alpha value of text color is zero to skip rendering text
- if(!mOpacityConstraint)
- {
- mOpacityConstraint = Constraint::New<float>(mImpl->mRenderer, Dali::DevelRenderer::Property::OPACITY, OpacityConstraint);
- mOpacityConstraint.AddSource(Source(actor, mAnimatableTextColorPropertyIndex));
- }
- mOpacityConstraint.Apply();
+ // Make zero if the alpha value of text color is zero to skip rendering text
+ if(!mOpacityConstraint)
+ {
+ mOpacityConstraint = Constraint::New<float>(mImpl->mRenderer, Dali::DevelRenderer::Property::OPACITY, OpacityConstraint);
+ mOpacityConstraint.AddSource(Source(actor, mAnimatableTextColorPropertyIndex));
+ mOpacityConstraint.Apply();
}
// Renderer needs textures and to be added to control
}
// Renderer needs textures and to be added to control
Constraint mColorConstraint{}; ///< Color constraint
Constraint mOpacityConstraint{}; ///< Opacity constraint
Property::Index mAnimatableTextColorPropertyIndex; ///< The index of animatable text color property registered by the control.
Constraint mColorConstraint{}; ///< Color constraint
Constraint mOpacityConstraint{}; ///< Opacity constraint
Property::Index mAnimatableTextColorPropertyIndex; ///< The index of animatable text color property registered by the control.
+ Property::Index mTextColorAnimatableIndex; ///< The index of uTextColorAnimatable property.
bool mRendererUpdateNeeded : 1; ///< The flag to indicate whether the renderer needs to be updated.
RendererContainer mRendererList;
};
bool mRendererUpdateNeeded : 1; ///< The flag to indicate whether the renderer needs to be updated.
RendererContainer mRendererList;
};