From: Heeyong Song Date: Mon, 16 Nov 2020 07:59:06 +0000 (+0900) Subject: Remove blend mode change when mixColor is changed X-Git-Tag: dali_2.0.2~3^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=refs%2Fchanges%2F65%2F247765%2F2;hp=863460d5c6f88c007f0c14356a102b5b4a724d1c Remove blend mode change when mixColor is changed Now the mix color opacity uses Renderer opacity. The Renderer change it internally if the blend mode is AUTO. So we don't need to change it. Change-Id: I63ed004e3263cd6f7a5f19a79f3031fedeb8ad81 --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp index e07933a..706f8da 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp @@ -773,12 +773,15 @@ int UtcDaliImageVisualAnimateMixColor(void) Animation animation = dummyImpl.CreateTransition( transition ); - blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::ON, TEST_LOCATION ); - animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE ); animation.Play(); + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + glAbstraction.EnableEnableDisableCallTrace( true ); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + std::ostringstream blendStr; + blendStr << GL_BLEND; + application.SendNotification(); application.Render(0); // Ensure animation starts application.Render(2000u); // Halfway point @@ -788,16 +791,21 @@ int UtcDaliImageVisualAnimateMixColor(void) DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue( "uColor", Vector4( 0.5f, 0.5f, 0.5f, 0.75f ) ), true, TEST_LOCATION ); DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue( "mixColor", testColor ), true, TEST_LOCATION ); + DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + + glEnableStack.Reset(); + application.Render(2000u); // Halfway point between blue and white DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue( "uColor", Vector4( 1.0f, 1.0f, 1.0f, 0.5f ) ), true, TEST_LOCATION ); DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue( "mixColor", Vector3( TARGET_MIX_COLOR ) ), true, TEST_LOCATION ); - TestMixColor( visual, Visual::Property::MIX_COLOR, TARGET_MIX_COLOR ); + // GL_BLEND should not be changed: Keep enabled + DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Disable", blendStr.str().c_str() ) ); - blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::ON, TEST_LOCATION ); + TestMixColor( visual, Visual::Property::MIX_COLOR, TARGET_MIX_COLOR ); END_TEST; } @@ -828,9 +836,16 @@ int UtcDaliImageVisualAnimateOpacity(void) DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION); - Renderer renderer = actor.GetRendererAt(0); - Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::ON, TEST_LOCATION ); + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + glAbstraction.EnableEnableDisableCallTrace( true ); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + std::ostringstream blendStr; + blendStr << GL_BLEND; + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); { tet_infoline( "Test that the opacity can be increased to full via animation, and that the blend mode is set appropriately at the start and end of the animation." ); @@ -849,6 +864,8 @@ int UtcDaliImageVisualAnimateOpacity(void) Animation animation = dummyImpl.CreateTransition( transition ); animation.Play(); + glEnableStack.Reset(); + application.SendNotification(); application.Render(0); // Ensure animation starts application.Render(2000u); // Halfway point through animation @@ -864,8 +881,8 @@ int UtcDaliImageVisualAnimateOpacity(void) DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue< Vector4 >( "uColor", color ) ); DALI_TEST_EQUALS( color.a, 1.0f, TEST_LOCATION ); - blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::AUTO, TEST_LOCATION ); + DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Disable", blendStr.str().c_str() ) ); } @@ -886,8 +903,7 @@ int UtcDaliImageVisualAnimateOpacity(void) Animation animation = dummyImpl.CreateTransition( transition ); animation.Play(); - blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::ON, TEST_LOCATION ); + glEnableStack.Reset(); application.SendNotification(); application.Render(0); // Ensure animation starts @@ -898,17 +914,21 @@ int UtcDaliImageVisualAnimateOpacity(void) DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue< Vector4 >( "uColor", color ) ); DALI_TEST_EQUALS( color.a, 0.55f, TEST_LOCATION ); + DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + + glEnableStack.Reset(); + application.Render(2016u); // end application.SendNotification(); DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue< Vector4 >( "uColor", color ) ); DALI_TEST_EQUALS( color.a, 0.1f, TEST_LOCATION ); - blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::ON, TEST_LOCATION ); + // GL_BLEND should not be changed: Keep enabled + DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Disable", blendStr.str().c_str() ) ); } - END_TEST; } @@ -975,26 +995,32 @@ int UtcDaliImageVisualAnimateOpacity02(void) animation = dummyImpl.CreateTransition( transition ); animation.Play(); + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + glAbstraction.EnableEnableDisableCallTrace( true ); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + std::ostringstream blendStr; + blendStr << GL_BLEND; + application.SendNotification(); application.Render(0); // Ensure animation starts application.Render(2000u); // Halfway point through animation application.SendNotification(); // Handle any signals - blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::ON, TEST_LOCATION ); + DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); Vector4 color; DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue< Vector4 >( "uColor", color ) ); DALI_TEST_EQUALS( color.a, 0.5f, TEST_LOCATION ); + glEnableStack.Reset(); + application.Render(2001u); // end application.SendNotification(); // ensure animation finished signal is sent DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue< Vector4 >( "uColor", color ) ); DALI_TEST_EQUALS( color.a, 1.0f, TEST_LOCATION ); - blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::AUTO, TEST_LOCATION ); + DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Disable", blendStr.str().c_str() ) ); END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TransitionData.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TransitionData.cpp index ab94ef2..ca57b44 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TransitionData.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TransitionData.cpp @@ -588,6 +588,12 @@ int UtcDaliTransitionDataMap5P(void) Animation anim = dummyImpl.CreateTransition( transition ); DALI_TEST_CHECK( anim ); + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + glAbstraction.EnableEnableDisableCallTrace( true ); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + std::ostringstream blendStr; + blendStr << GL_BLEND; + Renderer renderer = actor.GetRendererAt(0); Property::Index mixColorIndex = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR ); application.SendNotification(); @@ -595,28 +601,37 @@ int UtcDaliTransitionDataMap5P(void) DALI_TEST_EQUALS( renderer.GetProperty(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION); DALI_TEST_EQUALS( renderer.GetProperty( DevelRenderer::Property::OPACITY ), 0.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( renderer.GetProperty(Renderer::Property::BLEND_MODE), (int)BlendMode::ON, TEST_LOCATION ); DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION); DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 0.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION ); + + // The Renderer is transparent. So rendering is skipped. The state should not be changed. + DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Disable", blendStr.str().c_str() ) ); anim.Play(); + glEnableStack.Reset(); + application.SendNotification(); application.Render(500); // Start animation application.Render(500); // Halfway thru anim application.SendNotification(); DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION); DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 0.5f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION ); + + // Should not be changed + DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + + glEnableStack.Reset(); application.Render(501); // End of anim application.SendNotification(); application.Render(); DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION ); DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::AUTO, TEST_LOCATION ); + + DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Disable", blendStr.str().c_str() ) ); END_TEST; } @@ -662,6 +677,13 @@ int UtcDaliTransitionDataMap6P(void) Renderer renderer = actor.GetRendererAt(0); Property::Index mixColorIndex = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR ); + + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + glAbstraction.EnableEnableDisableCallTrace( true ); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + std::ostringstream blendStr; + blendStr << GL_BLEND; + application.SendNotification(); application.Render(0); @@ -670,27 +692,33 @@ int UtcDaliTransitionDataMap6P(void) DALI_TEST_EQUALS( renderer.GetProperty( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION ); DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION ); - // Note, This should be testing for AUTO - // this is the same problem as C# target value being set before Play is called. - // @todo How was this solved? - DALI_TEST_EQUALS( renderer.GetProperty(Renderer::Property::BLEND_MODE), (int)BlendMode::ON, TEST_LOCATION ); - DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION ); + // Default state is disabled. So test if "Enabled" is not called. + DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); anim.Play(); + glEnableStack.Reset(); + application.SendNotification(); application.Render(500); // Start animation application.Render(500); // Halfway thru anim application.SendNotification(); + DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION); DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 0.5f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION ); + + DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + + glEnableStack.Reset(); application.Render(500); // End of anim application.SendNotification(); + DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION ); DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 0.0f, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION ); + + // GL_BLEND should not be changed: Keep enabled + DALI_TEST_CHECK( !glEnableStack.FindMethodAndParams( "Disable", blendStr.str().c_str() ) ); END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp index f17f120..fde1197 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp @@ -1965,12 +1965,15 @@ int UtcDaliVisualAnimatePrimitiveVisual(void) Dali::Toolkit::TransitionData transition = TransitionData::New( map ); Animation animation = dummyImpl.CreateTransition( transition ); - Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::ON, TEST_LOCATION ); - animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE ); animation.Play(); + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + glAbstraction.EnableEnableDisableCallTrace( true ); + TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace(); + std::ostringstream blendStr; + blendStr << GL_BLEND; + application.SendNotification(); application.Render(0); application.Render(2000u); // halfway point @@ -1980,6 +1983,10 @@ int UtcDaliVisualAnimatePrimitiveVisual(void) DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("uColor", Vector4(0.5f, 0.5f, 0.5f, halfwayColor.a )), true, TEST_LOCATION ); DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("mixColor", Vector3(halfwayColor) ), true, TEST_LOCATION ); + DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) ); + + glEnableStack.Reset(); + application.Render(2001u); // go past end application.SendNotification(); // Trigger signals @@ -1987,8 +1994,7 @@ int UtcDaliVisualAnimatePrimitiveVisual(void) DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("uColor", Vector4( 1.0f, 1.0f, 1.0f, TARGET_MIX_COLOR.a ) ), true, TEST_LOCATION ); DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue("mixColor", Vector3(TARGET_MIX_COLOR) ), true, TEST_LOCATION ); - blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE ); - DALI_TEST_EQUALS( blendModeValue.Get(), (int)BlendMode::AUTO, TEST_LOCATION ); + DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Disable", blendStr.str().c_str() ) ); actor.Unparent(); } diff --git a/dali-toolkit/internal/visuals/visual-base-data-impl.cpp b/dali-toolkit/internal/visuals/visual-base-data-impl.cpp index 631f61b..c7b8a14 100644 --- a/dali-toolkit/internal/visuals/visual-base-data-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-base-data-impl.cpp @@ -117,7 +117,6 @@ bool GetPolicyFromValue( const Property::Value& value, Vector2& policy ) Internal::Visual::Base::Impl::Impl( FittingMode fittingMode, Toolkit::Visual::Type type ) : mCustomShader( NULL ), - mBlendSlotDelegate( NULL ), mEventObserver( NULL ), mTransform(), mMixColor( Color::WHITE ), @@ -137,7 +136,6 @@ Internal::Visual::Base::Impl::Impl( FittingMode fittingMode, Toolkit::Visual::Ty Internal::Visual::Base::Impl::~Impl() { delete mCustomShader; - delete mBlendSlotDelegate; } Internal::Visual::Base::Impl::CustomShader::CustomShader( const Property::Map& map ) diff --git a/dali-toolkit/internal/visuals/visual-base-data-impl.h b/dali-toolkit/internal/visuals/visual-base-data-impl.h index f563f94..ae7a93e 100644 --- a/dali-toolkit/internal/visuals/visual-base-data-impl.h +++ b/dali-toolkit/internal/visuals/visual-base-data-impl.h @@ -120,7 +120,6 @@ struct Base::Impl Renderer mRenderer; CustomShader* mCustomShader; - SlotDelegate* mBlendSlotDelegate; ///< Used to own mix color animation connection EventObserver* mEventObserver; ///< Allows controls to observe when the visual has events to notify std::string mName; Transform mTransform; diff --git a/dali-toolkit/internal/visuals/visual-base-impl.cpp b/dali-toolkit/internal/visuals/visual-base-impl.cpp index 748bcec..ce31fb1 100755 --- a/dali-toolkit/internal/visuals/visual-base-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-base-impl.cpp @@ -451,11 +451,6 @@ void Visual::Base::RegisterMixColor() Vector3(mImpl->mMixColor) ); } - if( mImpl->mMixColor.a < 1.f || IsAdvancedBlendEquationApplied() ) - { - mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); - } - mImpl->mRenderer.SetProperty( DevelRenderer::Property::OPACITY, mImpl->mMixColor.a ); float preMultipliedAlpha = 0.0f; @@ -474,10 +469,6 @@ void Visual::Base::SetMixColor( const Vector4& color ) { mImpl->mRenderer.SetProperty( mImpl->mMixColorIndex, Vector3(color) ); mImpl->mRenderer.SetProperty( DevelRenderer::Property::OPACITY, color.a ); - if( color.a < 1.f || IsAdvancedBlendEquationApplied() ) - { - mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); - } } } @@ -671,14 +662,6 @@ void Visual::Base::AnimateOpacityProperty( Dali::Animation& transition, Internal::TransitionData::Animator& animator ) { - bool isOpaque = mImpl->mMixColor.a >= 1.0f; - - float initialOpacity; - if( animator.initialValue.Get( initialOpacity ) ) - { - isOpaque = (initialOpacity >= 1.0f); - } - float targetOpacity; if( animator.targetValue.Get( targetOpacity ) ) { @@ -686,7 +669,6 @@ void Visual::Base::AnimateOpacityProperty( } SetupTransition( transition, animator, DevelRenderer::Property::OPACITY, animator.initialValue, animator.targetValue ); - SetupBlendMode( transition, isOpaque, animator.animate ); } void Visual::Base::AnimateRendererProperty( @@ -723,7 +705,6 @@ void Visual::Base::AnimateMixColorProperty( { Property::Index index = mImpl->mMixColorIndex; bool animateOpacity = false; - bool isOpaque = true; Property::Value initialOpacity; Property::Value targetOpacity; @@ -738,7 +719,6 @@ void Visual::Base::AnimateMixColorProperty( if( animator.initialValue.GetType() == Property::VECTOR4 ) { // if there is an initial color specifying alpha, test it - isOpaque = initialColor.a >= 1.0f; initialOpacity = initialColor.a; } initialMixColor = Vector3( initialColor ); @@ -766,54 +746,8 @@ void Visual::Base::AnimateMixColorProperty( if( animateOpacity ) { SetupTransition( transition, animator, DevelRenderer::Property::OPACITY, initialOpacity, targetOpacity ); - SetupBlendMode( transition, isOpaque, animator.animate ); - } - } -} - -void Visual::Base::SetupBlendMode( Animation& transition, bool isInitialOpaque, bool animating ) -{ - // Ensure the blend mode is turned on if we are animating opacity, and - // turned off after the animation ends if the final value is opaque - if( ( ! isInitialOpaque || mImpl->mMixColor.a < 1.0f ) || - ( mImpl->mRenderer && IsAdvancedBlendEquationApplied() ) ) - { - if( mImpl->mRenderer ) - { - mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); - - if( animating == true && mImpl->mMixColor.a >= 1.0f ) - { - // When it becomes opaque, set the blend mode back to automatically - if( ! mImpl->mBlendSlotDelegate ) - { - mImpl->mBlendSlotDelegate = new SlotDelegate(this); - } - transition.FinishedSignal().Connect( *(mImpl->mBlendSlotDelegate), - &Visual::Base::OnMixColorFinished ); - } - } - } -} - -void Visual::Base::OnMixColorFinished( Animation& animation ) -{ - if( mImpl->mRenderer ) - { - DALI_LOG_INFO( gVisualBaseLogFilter, Debug::General, "Visual::Base::OnMixColorFinished()\n"); - - if( mImpl->mMixColor.a >= 1.f && - !IsAdvancedBlendEquationApplied() ) - { - mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO ); - } - else - { - mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); } } - delete mImpl->mBlendSlotDelegate; - mImpl->mBlendSlotDelegate = NULL; } } // namespace Internal diff --git a/dali-toolkit/internal/visuals/visual-base-impl.h b/dali-toolkit/internal/visuals/visual-base-impl.h index 8fa2e5e..b6ab75e 100644 --- a/dali-toolkit/internal/visuals/visual-base-impl.h +++ b/dali-toolkit/internal/visuals/visual-base-impl.h @@ -442,25 +442,6 @@ private: void AnimateMixColorProperty( Dali::Animation& transition, Internal::TransitionData::Animator& animator ); - /** - * Set up the right blend mode if the opacity is being animated. - * Also ensure that when the animation finishes, the blend mode is - * set to the appropriate value. It also uses the target value as - * set into mMixColor. - * - * @param[in] transition The transition to listen to - * @param[in] isInitialOpaque Whether the initial value is opaque - * @param[in] animating If the transition animates the value. - */ - void SetupBlendMode( Dali::Animation& transition, - bool isInitialOpaque, bool animating ); - - /** - * When a mix color animation has finished, ensure the blend mode is set back - * to the right value for the target opacity. - */ - void OnMixColorFinished( Animation& animation ); - // Undefined Base( const Visual::Base& visual );