From: joogab yun Date: Thu, 19 Nov 2020 09:35:54 +0000 (+0000) Subject: Merge "[dali-toolkit] TextEditor/TextField add PrimaryCursorPosition property Add... X-Git-Tag: dali_2.0.2~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=cc2f88a5667c1a0cd19e6fd4756bb50d55128889;hp=8bb76057c85d620f72dfad6e10a8cd286f86faa7 Merge "[dali-toolkit] TextEditor/TextField add PrimaryCursorPosition property Add property to control primary cursor position" into devel/master --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp index 396bab4..ddca23f 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp @@ -1244,3 +1244,28 @@ int UtcDaliControlDoActionWhenNotStage(void) END_TEST; } + +int UtcDaliControlStopObservingVisual(void) +{ + ToolkitTestApplication application; + tet_infoline( "Test to stop observing a visual when a control is destroyed" ); + + Control control = Control::New(); + control[Actor::Property::SIZE] = Vector2( 200.f, 200.f ); + control[Control::Property::BACKGROUND] = "invalid.svg"; + + application.GetScene().Add( control ); + + application.SendNotification(); + application.Render(); + + // Delete control + control.Unparent(); + control.Reset(); + + // SVG rasterization may be finished after the control is deleted. + // Ensure it doesn't cause a crash. + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + + END_TEST; +} 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/controls/control/control-data-impl.cpp b/dali-toolkit/internal/controls/control/control-data-impl.cpp index df01b27..9182c1f 100755 --- a/dali-toolkit/internal/controls/control/control-data-impl.cpp +++ b/dali-toolkit/internal/controls/control/control-data-impl.cpp @@ -459,6 +459,16 @@ Control::Impl::Impl( Control& controlImpl ) Control::Impl::~Impl() { + for( auto&& iter : mVisuals ) + { + StopObservingVisual( iter->visual ); + } + + for( auto&& iter : mRemoveVisuals ) + { + StopObservingVisual( iter->visual ); + } + AccessibilityDeregister(); // All gesture detectors will be destroyed so no need to disconnect. delete mStartingPinchScale; diff --git a/dali-toolkit/internal/visuals/texture-manager-impl.cpp b/dali-toolkit/internal/visuals/texture-manager-impl.cpp index 5e0b506..00b8eca 100644 --- a/dali-toolkit/internal/visuals/texture-manager-impl.cpp +++ b/dali-toolkit/internal/visuals/texture-manager-impl.cpp @@ -82,15 +82,15 @@ namespace Debug::Filter* gTextureManagerLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_TEXTURE_MANAGER" ); #define GET_LOAD_STATE_STRING( loadState ) \ - loadState == TextureManager::NOT_STARTED ? "NOT_STARTED" : \ - loadState == TextureManager::LOADING ? "LOADING" : \ - loadState == TextureManager::LOAD_FINISHED ? "LOAD_FINISHED" : \ - loadState == TextureManager::WAITING_FOR_MASK ? "WAITING_FOR_MASK" : \ - loadState == TextureManager::MASK_APPLYING ? "MASK_APPLYING" : \ - loadState == TextureManager::MASK_APPLIED ? "MASK_APPLIED" : \ - loadState == TextureManager::UPLOADED ? "UPLOADED" : \ - loadState == TextureManager::CANCELLED ? "CANCELLED" : \ - loadState == TextureManager::LOAD_FAILED ? "LOAD_FAILED" : "Unknown" + loadState == TextureManager::LoadState::NOT_STARTED ? "NOT_STARTED" : \ + loadState == TextureManager::LoadState::LOADING ? "LOADING" : \ + loadState == TextureManager::LoadState::LOAD_FINISHED ? "LOAD_FINISHED" : \ + loadState == TextureManager::LoadState::WAITING_FOR_MASK ? "WAITING_FOR_MASK" : \ + loadState == TextureManager::LoadState::MASK_APPLYING ? "MASK_APPLYING" : \ + loadState == TextureManager::LoadState::MASK_APPLIED ? "MASK_APPLIED" : \ + loadState == TextureManager::LoadState::UPLOADED ? "UPLOADED" : \ + loadState == TextureManager::LoadState::CANCELLED ? "CANCELLED" : \ + loadState == TextureManager::LoadState::LOAD_FAILED ? "LOAD_FAILED" : "Unknown" #endif @@ -192,10 +192,10 @@ TextureSet TextureManager::LoadAnimatedImageTexture( { auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY; textureId = RequestLoadInternal( animatedImageLoading.GetUrl(), INVALID_TEXTURE_ID, 1.0f, ImageDimensions(), FittingMode::SCALE_TO_FILL, - SamplingMode::BOX_THEN_LINEAR, TextureManager::NO_ATLAS, false, UPLOAD_TO_TEXTURE, textureObserver, + SamplingMode::BOX_THEN_LINEAR, TextureManager::NO_ATLAS, false, StorageType::UPLOAD_TO_TEXTURE, textureObserver, true, TextureManager::ReloadPolicy::CACHED, preMultiply, animatedImageLoading, frameIndex ); TextureManager::LoadState loadState = GetTextureStateInternal( textureId ); - if( loadState == TextureManager::UPLOADED ) + if( loadState == TextureManager::LoadState::UPLOADED ) { // UploadComplete has already been called - keep the same texture set textureSet = GetTextureSet( textureId ); @@ -231,7 +231,7 @@ Devel::PixelBuffer TextureManager::LoadPixelBuffer( else { RequestLoadInternal( url, INVALID_TEXTURE_ID, 1.0f, desiredSize, fittingMode, samplingMode, TextureManager::NO_ATLAS, - false, RETURN_PIXEL_BUFFER, textureObserver, orientationCorrection, TextureManager::ReloadPolicy::FORCED, + false, StorageType::RETURN_PIXEL_BUFFER, textureObserver, orientationCorrection, TextureManager::ReloadPolicy::FORCED, preMultiplyOnLoad, Dali::AnimatedImageLoading(), 0u ); } @@ -359,7 +359,7 @@ TextureSet TextureManager::LoadTexture( } TextureManager::LoadState loadState = GetTextureStateInternal( textureId ); - if( loadState == TextureManager::UPLOADED ) + if( loadState == TextureManager::LoadState::UPLOADED ) { // UploadComplete has already been called - keep the same texture set textureSet = GetTextureSet( textureId ); @@ -367,11 +367,11 @@ TextureSet TextureManager::LoadTexture( // If we are loading the texture, or waiting for the ready signal handler to complete, inform // caller that they need to wait. - loadingStatus = ( loadState == TextureManager::LOADING || - loadState == TextureManager::WAITING_FOR_MASK || - loadState == TextureManager::MASK_APPLYING || - loadState == TextureManager::MASK_APPLIED || - loadState == TextureManager::NOT_STARTED || + loadingStatus = ( loadState == TextureManager::LoadState::LOADING || + loadState == TextureManager::LoadState::WAITING_FOR_MASK || + loadState == TextureManager::LoadState::MASK_APPLYING || + loadState == TextureManager::LoadState::MASK_APPLIED || + loadState == TextureManager::LoadState::NOT_STARTED || mQueueLoadFlag ); } @@ -403,7 +403,7 @@ TextureManager::TextureId TextureManager::RequestLoad( TextureManager::MultiplyOnLoad& preMultiplyOnLoad ) { return RequestLoadInternal( url, INVALID_TEXTURE_ID, 1.0f, desiredSize, fittingMode, samplingMode, useAtlas, - false, UPLOAD_TO_TEXTURE, observer, orientationCorrection, reloadPolicy, + false, StorageType::UPLOAD_TO_TEXTURE, observer, orientationCorrection, reloadPolicy, preMultiplyOnLoad, Dali::AnimatedImageLoading(), 0u ); } @@ -422,7 +422,7 @@ TextureManager::TextureId TextureManager::RequestLoad( TextureManager::MultiplyOnLoad& preMultiplyOnLoad ) { return RequestLoadInternal( url, maskTextureId, contentScale, desiredSize, fittingMode, samplingMode, useAtlas, - cropToMask, UPLOAD_TO_TEXTURE, observer, orientationCorrection, reloadPolicy, + cropToMask, StorageType::UPLOAD_TO_TEXTURE, observer, orientationCorrection, reloadPolicy, preMultiplyOnLoad, Dali::AnimatedImageLoading(), 0u ); } @@ -431,7 +431,7 @@ TextureManager::TextureId TextureManager::RequestMaskLoad( const VisualUrl& mask // Use the normal load procedure to get the alpha mask. auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY; return RequestLoadInternal( maskUrl, INVALID_TEXTURE_ID, 1.0f, ImageDimensions(), FittingMode::SCALE_TO_FILL, - SamplingMode::NO_FILTER, NO_ATLAS, false, KEEP_PIXEL_BUFFER, NULL, true, + SamplingMode::NO_FILTER, NO_ATLAS, false, StorageType::KEEP_PIXEL_BUFFER, NULL, true, TextureManager::ReloadPolicy::CACHED, preMultiply, Dali::AnimatedImageLoading(), 0u ); } @@ -508,37 +508,37 @@ TextureManager::TextureId TextureManager::RequestLoadInternal( // Force reloading of texture by setting loadState unless already loading or cancelled. if ( TextureManager::ReloadPolicy::FORCED == reloadPolicy && - TextureManager::LOADING != textureInfo.loadState && - TextureManager::WAITING_FOR_MASK != textureInfo.loadState && - TextureManager::MASK_APPLYING != textureInfo.loadState && - TextureManager::MASK_APPLIED != textureInfo.loadState && - TextureManager::CANCELLED != textureInfo.loadState ) + TextureManager::LoadState::LOADING != textureInfo.loadState && + TextureManager::LoadState::WAITING_FOR_MASK != textureInfo.loadState && + TextureManager::LoadState::MASK_APPLYING != textureInfo.loadState && + TextureManager::LoadState::MASK_APPLIED != textureInfo.loadState && + TextureManager::LoadState::CANCELLED != textureInfo.loadState ) { DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Verbose, "TextureManager::RequestLoad( url=%s observer=%p ) ForcedReload cacheIndex:%d, textureId=%d\n", url.GetUrl().c_str(), observer, cacheIndex, textureId ); - textureInfo.loadState = TextureManager::NOT_STARTED; + textureInfo.loadState = TextureManager::LoadState::NOT_STARTED; } // Check if we should add the observer. // Only do this if we have not loaded yet and it will not have loaded by the end of this method. switch( textureInfo.loadState ) { - case TextureManager::LOAD_FAILED: // Failed notifies observer which then stops observing. - case TextureManager::NOT_STARTED: + case TextureManager::LoadState::LOAD_FAILED: // Failed notifies observer which then stops observing. + case TextureManager::LoadState::NOT_STARTED: { LoadOrQueueTexture( textureInfo, observer ); // If called inside NotifyObservers, queues until afterwards break; } - case TextureManager::LOADING: - case TextureManager::WAITING_FOR_MASK: - case TextureManager::MASK_APPLYING: - case TextureManager::MASK_APPLIED: + case TextureManager::LoadState::LOADING: + case TextureManager::LoadState::WAITING_FOR_MASK: + case TextureManager::LoadState::MASK_APPLYING: + case TextureManager::LoadState::MASK_APPLIED: { ObserveTexture( textureInfo, observer ); break; } - case TextureManager::UPLOADED: + case TextureManager::LoadState::UPLOADED: { if( observer ) { @@ -546,15 +546,15 @@ TextureManager::TextureId TextureManager::RequestLoadInternal( } break; } - case TextureManager::CANCELLED: + case TextureManager::LoadState::CANCELLED: { // A cancelled texture hasn't finished loading yet. Treat as a loading texture // (it's ref count has already been incremented, above) - textureInfo.loadState = TextureManager::LOADING; + textureInfo.loadState = TextureManager::LoadState::LOADING; ObserveTexture( textureInfo, observer ); break; } - case TextureManager::LOAD_FINISHED: + case TextureManager::LoadState::LOAD_FINISHED: { // Loading has already completed. if( observer && textureInfo.storageType == StorageType::RETURN_PIXEL_BUFFER ) @@ -589,7 +589,7 @@ void TextureManager::Remove( const TextureManager::TextureId textureId, TextureU bool removeTextureInfo = false; // If loaded, we can remove the TextureInfo and the Atlas (if atlased). - if( textureInfo.loadState == UPLOADED ) + if( textureInfo.loadState == LoadState::UPLOADED ) { if( textureInfo.atlas ) { @@ -597,11 +597,11 @@ void TextureManager::Remove( const TextureManager::TextureId textureId, TextureU } removeTextureInfo = true; } - else if( textureInfo.loadState == LOADING ) + else if( textureInfo.loadState == LoadState::LOADING ) { // We mark the textureInfo for removal. // Once the load has completed, this method will be called again. - textureInfo.loadState = CANCELLED; + textureInfo.loadState = LoadState::CANCELLED; } else { @@ -650,7 +650,7 @@ VisualUrl TextureManager::GetVisualUrl( TextureId textureId ) TextureManager::LoadState TextureManager::GetTextureState( TextureId textureId ) { - LoadState loadState = TextureManager::NOT_STARTED; + LoadState loadState = TextureManager::LoadState::NOT_STARTED; int cacheIndex = GetCacheIndexFromId( textureId ); if( cacheIndex != INVALID_CACHE_INDEX ) @@ -674,7 +674,7 @@ TextureManager::LoadState TextureManager::GetTextureState( TextureId textureId ) TextureManager::LoadState TextureManager::GetTextureStateInternal( TextureId textureId ) { - LoadState loadState = TextureManager::NOT_STARTED; + LoadState loadState = TextureManager::LoadState::NOT_STARTED; int cacheIndex = GetCacheIndexFromId( textureId ); if( cacheIndex != INVALID_CACHE_INDEX ) @@ -774,8 +774,8 @@ void TextureManager::LoadOrQueueTexture( TextureInfo& textureInfo, TextureUpload { switch( textureInfo.loadState ) { - case NOT_STARTED: - case LOAD_FAILED: + case LoadState::NOT_STARTED: + case LoadState::LOAD_FAILED: { if( mQueueLoadFlag ) { @@ -787,7 +787,7 @@ void TextureManager::LoadOrQueueTexture( TextureInfo& textureInfo, TextureUpload } break; } - case UPLOADED: + case LoadState::UPLOADED: { if( mQueueLoadFlag ) { @@ -803,12 +803,12 @@ void TextureManager::LoadOrQueueTexture( TextureInfo& textureInfo, TextureUpload } break; } - case LOADING: - case CANCELLED: - case LOAD_FINISHED: - case WAITING_FOR_MASK: - case MASK_APPLYING: - case MASK_APPLIED: + case LoadState::LOADING: + case LoadState::CANCELLED: + case LoadState::LOAD_FINISHED: + case LoadState::WAITING_FOR_MASK: + case LoadState::MASK_APPLYING: + case LoadState::MASK_APPLIED: { break; } @@ -828,7 +828,7 @@ void TextureManager::LoadTexture( TextureInfo& textureInfo, TextureUploadObserve DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::LoadTexture(): url:%s sync:%s\n", textureInfo.url.GetUrl().c_str(), textureInfo.loadSynchronously?"T":"F" ); - textureInfo.loadState = LOADING; + textureInfo.loadState = LoadState::LOADING; if( !textureInfo.loadSynchronously ) { auto& loadersContainer = textureInfo.url.IsLocalResource() ? mAsyncLocalLoaders : mAsyncRemoteLoaders; @@ -864,13 +864,13 @@ void TextureManager::ProcessQueuedTextures() if( cacheIndex != INVALID_CACHE_INDEX ) { TextureInfo& textureInfo( mTextureInfoContainer[cacheIndex] ); - if( textureInfo.loadState == UPLOADED ) + if( textureInfo.loadState == LoadState::UPLOADED ) { element.mObserver->UploadComplete( true, textureInfo.textureId, textureInfo.textureSet, textureInfo.useAtlas, textureInfo.atlasRect, textureInfo.preMultiplied ); } - else if ( textureInfo.loadState == LOAD_FINISHED && textureInfo.storageType == StorageType::RETURN_PIXEL_BUFFER ) + else if ( textureInfo.loadState == LoadState::LOAD_FINISHED && textureInfo.storageType == StorageType::RETURN_PIXEL_BUFFER ) { element.mObserver->LoadComplete( true, textureInfo.pixelBuffer, textureInfo.url, textureInfo.preMultiplied ); } @@ -916,7 +916,7 @@ void TextureManager::AsyncLoadComplete( AsyncLoadingInfoContainerType& loadingCo " textureId:%d Url:%s CacheIndex:%d LoadState: %d\n", textureInfo.textureId, textureInfo.url.GetUrl().c_str(), cacheIndex, textureInfo.loadState ); - if( textureInfo.loadState != CANCELLED ) + if( textureInfo.loadState != LoadState::CANCELLED ) { // textureInfo can be invalidated after this call (as the mTextureInfoContainer may be modified) PostLoad( textureInfo, pixelBuffer ); @@ -941,16 +941,16 @@ void TextureManager::PostLoad( TextureInfo& textureInfo, Devel::PixelBuffer& pix textureInfo.useAtlas = NO_ATLAS; textureInfo.preMultiplied = pixelBuffer.IsAlphaPreMultiplied(); - if( textureInfo.storageType == UPLOAD_TO_TEXTURE ) + if( textureInfo.storageType == StorageType::UPLOAD_TO_TEXTURE ) { // If there is a mask texture ID associated with this texture, then apply the mask // if it's already loaded. If it hasn't, and the mask is still loading, // wait for the mask to finish loading. if( textureInfo.maskTextureId != INVALID_TEXTURE_ID ) { - if( textureInfo.loadState == MASK_APPLYING ) + if( textureInfo.loadState == LoadState::MASK_APPLYING ) { - textureInfo.loadState = MASK_APPLIED; + textureInfo.loadState = LoadState::MASK_APPLIED; UploadTexture( pixelBuffer, textureInfo ); NotifyObservers( textureInfo, true ); } @@ -958,11 +958,11 @@ void TextureManager::PostLoad( TextureInfo& textureInfo, Devel::PixelBuffer& pix { LoadState maskLoadState = GetTextureStateInternal( textureInfo.maskTextureId ); textureInfo.pixelBuffer = pixelBuffer; // Store the pixel buffer temporarily - if( maskLoadState == LOADING ) + if( maskLoadState == LoadState::LOADING ) { - textureInfo.loadState = WAITING_FOR_MASK; + textureInfo.loadState = LoadState::WAITING_FOR_MASK; } - else if( maskLoadState == LOAD_FINISHED ) + else if( maskLoadState == LoadState::LOAD_FINISHED ) { // Send New Task to Thread ApplyMask( textureInfo, textureInfo.maskTextureId ); @@ -978,7 +978,7 @@ void TextureManager::PostLoad( TextureInfo& textureInfo, Devel::PixelBuffer& pix else { textureInfo.pixelBuffer = pixelBuffer; // Store the pixel data - textureInfo.loadState = LOAD_FINISHED; + textureInfo.loadState = LoadState::LOAD_FINISHED; if( textureInfo.storageType == StorageType::RETURN_PIXEL_BUFFER ) { @@ -995,7 +995,7 @@ void TextureManager::PostLoad( TextureInfo& textureInfo, Devel::PixelBuffer& pix else { // @todo If the load was unsuccessful, upload the broken image. - textureInfo.loadState = LOAD_FAILED; + textureInfo.loadState = LoadState::LOAD_FAILED; CheckForWaitingTexture( textureInfo ); NotifyObservers( textureInfo, false ); } @@ -1010,11 +1010,11 @@ void TextureManager::CheckForWaitingTexture( TextureInfo& maskTextureInfo ) for( unsigned int cacheIndex = 0; cacheIndex < size; ++cacheIndex ) { if( mTextureInfoContainer[cacheIndex].maskTextureId == maskTextureInfo.textureId && - mTextureInfoContainer[cacheIndex].loadState == WAITING_FOR_MASK ) + mTextureInfoContainer[cacheIndex].loadState == LoadState::WAITING_FOR_MASK ) { TextureInfo& textureInfo( mTextureInfoContainer[cacheIndex] ); - if( maskTextureInfo.loadState == LOAD_FINISHED ) + if( maskTextureInfo.loadState == LoadState::LOAD_FINISHED ) { // Send New Task to Thread ApplyMask( textureInfo, maskTextureInfo.textureId ); @@ -1022,7 +1022,7 @@ void TextureManager::CheckForWaitingTexture( TextureInfo& maskTextureInfo ) else { textureInfo.pixelBuffer.Reset(); - textureInfo.loadState = LOAD_FAILED; + textureInfo.loadState = LoadState::LOAD_FAILED; NotifyObservers( textureInfo, false ); } } @@ -1041,7 +1041,7 @@ void TextureManager::ApplyMask( TextureInfo& textureInfo, TextureId maskTextureI DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::ApplyMask(): url:%s sync:%s\n", textureInfo.url.GetUrl().c_str(), textureInfo.loadSynchronously?"T":"F" ); - textureInfo.loadState = MASK_APPLYING; + textureInfo.loadState = LoadState::MASK_APPLYING; auto& loadersContainer = textureInfo.url.IsLocalResource() ? mAsyncLocalLoaders : mAsyncRemoteLoaders; auto loadingHelperIt = loadersContainer.GetNext(); auto premultiplyOnLoad = textureInfo.preMultiplyOnLoad ? DevelAsyncImageLoader::PreMultiplyOnLoad::ON : DevelAsyncImageLoader::PreMultiplyOnLoad::OFF; @@ -1081,7 +1081,7 @@ void TextureManager::UploadTexture( Devel::PixelBuffer& pixelBuffer, TextureInfo // Note: This is regardless of success as we care about whether a // load attempt is in progress or not. If unsuccessful, a broken // image is still loaded. - textureInfo.loadState = UPLOADED; + textureInfo.loadState = LoadState::UPLOADED; } void TextureManager::NotifyObservers( TextureInfo& textureInfo, bool success ) @@ -1194,7 +1194,7 @@ TextureManager::TextureHash TextureManager::GenerateHash( // Bit-pack the FittingMode, SamplingMode and atlasing. // FittingMode=2bits, SamplingMode=3bits, useAtlas=1bit, storageType=2bits - *hashTargetPtr = ( fittingMode << 6u ) | ( samplingMode << 3 ) | ( useAtlas << 2 ) | storageType; + *hashTargetPtr = ( fittingMode << 6u ) | ( samplingMode << 3 ) | ( useAtlas << 2 ) | static_cast(storageType); } else { diff --git a/dali-toolkit/internal/visuals/texture-manager-impl.h b/dali-toolkit/internal/visuals/texture-manager-impl.h index f8500c7..89afd47 100644 --- a/dali-toolkit/internal/visuals/texture-manager-impl.h +++ b/dali-toolkit/internal/visuals/texture-manager-impl.h @@ -76,7 +76,7 @@ public: /** * Whether the pixel data should be kept in TextureManager, returned with pixelBuffer or uploaded for rendering */ - enum StorageType + enum class StorageType: uint8_t { KEEP_PIXEL_BUFFER, RETURN_PIXEL_BUFFER, @@ -86,7 +86,7 @@ public: /** * Whether the texture should be loaded synchronously or asynchronously. */ - enum LoadType + enum class LoadType: uint8_t { LOAD_ASYNCHRONOUSLY, LOAD_SYNCHRONOUSLY @@ -95,7 +95,7 @@ public: /** * @brief The LoadState Enumeration represents the current state of a particular Texture's life-cycle. */ - enum LoadState + enum class LoadState: uint8_t { NOT_STARTED, ///< Default LOADING, ///< Loading has been started, but not finished. @@ -530,10 +530,10 @@ private: hash( hash ), scaleFactor( scaleFactor ), referenceCount( 1u ), - loadState( NOT_STARTED ), + loadState( LoadState::NOT_STARTED ), fittingMode( fittingMode ), samplingMode( samplingMode ), - storageType( UPLOAD_TO_TEXTURE ), + storageType( StorageType::UPLOAD_TO_TEXTURE ), animatedImageLoading( animatedImageLoading ), frameIndex( frameIndex ), loadSynchronously( loadSynchronously ), @@ -563,10 +563,10 @@ private: TextureManager::TextureHash hash; ///< The hash used to cache this Texture float scaleFactor; ///< The scale factor to apply to the Texture when masking int16_t referenceCount; ///< The reference count of clients using this Texture - LoadState loadState:4; ///< The load state showing the load progress of the Texture + LoadState loadState; ///< The load state showing the load progress of the Texture FittingMode::Type fittingMode:3; ///< The requested FittingMode Dali::SamplingMode::Type samplingMode:3; ///< The requested SamplingMode - StorageType storageType:2; ///< CPU storage / GPU upload; + StorageType storageType; ///< CPU storage / GPU upload; Dali::AnimatedImageLoading animatedImageLoading; ///< AnimatedImageLoading that contains animated image information. uint32_t frameIndex; ///< frame index that be loaded, in case of animated image bool loadSynchronously:1; ///< True if synchronous loading was requested 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 ); diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 2367539..f0756cd 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -29,7 +29,7 @@ namespace Toolkit { const unsigned int TOOLKIT_MAJOR_VERSION = 2; const unsigned int TOOLKIT_MINOR_VERSION = 0; -const unsigned int TOOLKIT_MICRO_VERSION = 0; +const unsigned int TOOLKIT_MICRO_VERSION = 1; const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index aae6b64..6e6bc45 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali2-toolkit Summary: Dali 3D engine Toolkit -Version: 2.0.0 +Version: 2.0.1 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT