X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-base-impl.cpp;h=748bcec94ff372942137fedc82180eb13a564874;hp=69e859bd6287fc08c282aaa344e14ee4b7523bf7;hb=b86fa7f2bedebe580b0e9a20f9b42cf2d628fafa;hpb=37aa8e50d140ee95be5f03fadbc269a0a239adde diff --git a/dali-toolkit/internal/visuals/visual-base-impl.cpp b/dali-toolkit/internal/visuals/visual-base-impl.cpp index 69e859b..748bcec 100755 --- a/dali-toolkit/internal/visuals/visual-base-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-base-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -20,7 +20,6 @@ // EXTERNAL HEADER #include -#include #include #include #include @@ -368,7 +367,6 @@ void Visual::Base::CreatePropertyMap( Property::Map& map ) const // which is ok, because they have a different key value range. map.Insert( Toolkit::Visual::Property::MIX_COLOR, mImpl->mMixColor ); // vec4 map.Insert( Toolkit::Visual::Property::OPACITY, mImpl->mMixColor.a ); - map.Insert( Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, IsSynchronousLoadingRequired() ); auto fittingModeString = Scripting::GetLinearEnumerationName< FittingMode >( mImpl->mFittingMode, VISUAL_FITTING_MODE_TABLE, VISUAL_FITTING_MODE_TABLE_COUNT ); @@ -415,6 +413,11 @@ bool Visual::Base::IsPreMultipliedAlphaEnabled() const return mImpl->mFlags & Impl::IS_PREMULTIPLIED_ALPHA; } +bool Visual::Base::IsAdvancedBlendEquationApplied() const +{ + return IsPreMultipliedAlphaEnabled() && DevelRenderer::IsAdvancedBlendEquationApplied( mImpl->mRenderer ); +} + void Visual::Base::DoSetOffScene( Actor& actor ) { actor.RemoveRenderer( mImpl->mRenderer ); @@ -442,14 +445,13 @@ void Visual::Base::RegisterMixColor() // (Color and Primitive visuals will register their own and save to this index) if( mImpl->mMixColorIndex == Property::INVALID_INDEX ) { - mImpl->mMixColorIndex = DevelHandle::RegisterProperty( - mImpl->mRenderer, + mImpl->mMixColorIndex = mImpl->mRenderer.RegisterProperty( Toolkit::Visual::Property::MIX_COLOR, MIX_COLOR, Vector3(mImpl->mMixColor) ); } - if( mImpl->mMixColor.a < 1.f ) + if( mImpl->mMixColor.a < 1.f || IsAdvancedBlendEquationApplied() ) { mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); } @@ -472,7 +474,7 @@ 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 ) + if( color.a < 1.f || IsAdvancedBlendEquationApplied() ) { mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); } @@ -557,13 +559,13 @@ Renderer Visual::Base::GetRenderer() Property::Index Visual::Base::GetPropertyIndex( Property::Key key ) { - Property::Index index = DevelHandle::GetPropertyIndex( mImpl->mRenderer, key ); + Property::Index index = mImpl->mRenderer.GetPropertyIndex( key ); if( index == Property::INVALID_INDEX ) { // Is it a shader property? Shader shader = mImpl->mRenderer.GetShader(); - index = DevelHandle::GetPropertyIndex( shader, key ); + index = shader.GetPropertyIndex( key ); if( index != Property::INVALID_INDEX ) { // Yes - we should register it in the Renderer so it can be set / animated @@ -581,7 +583,7 @@ Property::Index Visual::Base::GetPropertyIndex( Property::Key key ) // Leave keyIndex as INVALID_KEY - it can still be registered against the string key. } Property::Value value = shader.GetProperty( index ); - index = DevelHandle::RegisterProperty( mImpl->mRenderer, keyIndex, keyName, value ); + index = mImpl->mRenderer.RegisterProperty( keyIndex, keyName, value ); } } return index; @@ -773,7 +775,8 @@ void Visual::Base::SetupBlendMode( Animation& transition, bool isInitialOpaque, { // 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 ) + if( ( ! isInitialOpaque || mImpl->mMixColor.a < 1.0f ) || + ( mImpl->mRenderer && IsAdvancedBlendEquationApplied() ) ) { if( mImpl->mRenderer ) { @@ -798,8 +801,16 @@ void Visual::Base::OnMixColorFinished( Animation& animation ) if( mImpl->mRenderer ) { DALI_LOG_INFO( gVisualBaseLogFilter, Debug::General, "Visual::Base::OnMixColorFinished()\n"); - mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, - ( mImpl->mMixColor.a < 1.0 ) ? BlendMode::ON : BlendMode::AUTO ); + + 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;