From e8d23607bbd06346b420f8a442bb88b6820e24ff Mon Sep 17 00:00:00 2001 From: "dongsug.song" Date: Tue, 15 Nov 2016 11:49:49 +0900 Subject: [PATCH] Revert "[3.0] Stop creating image visuals by default" This reverts commit 5db2ae3e9c500db3c5a58457e4f212d51073727a. Change-Id: I27d834df57d9009e353eafcdcfb222116e94f6e9 --- .../src/dali-toolkit/utc-Dali-VisualFactory.cpp | 24 ++-------------------- .../controls/effects-view/effects-view-impl.cpp | 8 ++++---- dali-toolkit/internal/filters/emboss-filter.cpp | 12 ++++------- .../internal/visuals/visual-factory-impl.cpp | 8 ++++++++ 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp b/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp index 3c573f1..f332a7f 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp @@ -880,13 +880,13 @@ int UtcDaliVisualFactoryGetNPatchVisualN2(void) //This should still load but display an error image ToolkitTestApplication application; - tet_infoline( "UtcDaliVisualFactoryGetNPatchVisualN: Request n-patch visual with an invalid URL" ); + tet_infoline( "UtcDaliVisualFactoryGetNPatchVisualN: Request n-patch visual with an invalid Property::Map" ); VisualFactory factory = VisualFactory::Get(); DALI_TEST_CHECK( factory ); Property::Map propertyMap; - propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE ); + propertyMap.Insert( Visual::Property::TYPE, 111 ); propertyMap.Insert( ImageVisual::Property::URL, "ERROR.9.jpg" ); Visual::Base visual = factory.CreateVisual( propertyMap ); @@ -911,26 +911,6 @@ int UtcDaliVisualFactoryGetNPatchVisualN2(void) END_TEST; } -int UtcDaliVisualFactoryGetNPatchVisualN3(void) -{ - // Passing in an invalid visual type so we should not get a visual - - ToolkitTestApplication application; - tet_infoline( "UtcDaliVisualFactoryGetNPatchVisualN: Request n-patch visual with an invalid visual type" ); - - VisualFactory factory = VisualFactory::Get(); - DALI_TEST_CHECK( factory ); - - Property::Map propertyMap; - propertyMap.Insert( Visual::Property::TYPE, 111 ); - propertyMap.Insert( ImageVisual::Property::URL, "ERROR.9.jpg" ); - - Visual::Base visual = factory.CreateVisual( propertyMap ); - DALI_TEST_CHECK( !visual ); - - END_TEST; -} - int UtcDaliVisualFactoryGetSvgVisual(void) { ToolkitTestApplication application; diff --git a/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp b/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp index ed94ff8..70dbd3f 100644 --- a/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp +++ b/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp @@ -36,7 +36,6 @@ #include #include #include -#include namespace Dali { @@ -162,6 +161,8 @@ void EffectsView::SetType( Toolkit::EffectsView::EffectType type ) RemoveFilters(); Actor self = Self(); + Property::Map visualMap; + visualMap.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE ); switch( type ) { @@ -184,12 +185,11 @@ void EffectsView::SetType( Toolkit::EffectsView::EffectType type ) } } - Image dummyImage; // Dummy image, force creation of an image visual - InitializeVisual( self, mVisualPostFilter, dummyImage ); Property::Map customShader; customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = EFFECTS_VIEW_VERTEX_SOURCE; customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = EFFECTS_VIEW_FRAGMENT_SOURCE; - Toolkit::GetImplementation( mVisualPostFilter ).SetCustomShader( customShader ); + visualMap[ Toolkit::Visual::Property::SHADER ] = customShader; + InitializeVisual( self, mVisualPostFilter, visualMap ); mEffectType = type; } diff --git a/dali-toolkit/internal/filters/emboss-filter.cpp b/dali-toolkit/internal/filters/emboss-filter.cpp index 4bb7c30..c10d122 100644 --- a/dali-toolkit/internal/filters/emboss-filter.cpp +++ b/dali-toolkit/internal/filters/emboss-filter.cpp @@ -30,7 +30,6 @@ // INTERNAL INCLUDES #include #include -#include namespace Dali { @@ -124,16 +123,13 @@ void EmbossFilter::Enable() mActorForComposite.SetColor( Color::BLACK ); customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = COMPOSITE_FRAGMENT_SOURCE; + visualMap[ Toolkit::Visual::Property::SHADER ] = customShader; + visualMap[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::IMAGE; mRootActor.Add( mActorForComposite ); - Image dummyImage; // Dummy image, force creation of an image visual - - InitializeVisual( mActorForComposite, mVisualForEmboss1, dummyImage ); - Toolkit::GetImplementation( mVisualForEmboss1 ).SetCustomShader( customShader ); - - InitializeVisual( mActorForComposite, mVisualForEmboss2, dummyImage ); - Toolkit::GetImplementation( mVisualForEmboss2 ).SetCustomShader( customShader ); + InitializeVisual( mActorForComposite, mVisualForEmboss1, visualMap ); + InitializeVisual( mActorForComposite, mVisualForEmboss2, visualMap ); TextureSet textureSet1 = TextureSet::New(); TextureSetImage( textureSet1, 0, mImageForEmboss1 ); diff --git a/dali-toolkit/internal/visuals/visual-factory-impl.cpp b/dali-toolkit/internal/visuals/visual-factory-impl.cpp index 799fe6d..d7664ae 100644 --- a/dali-toolkit/internal/visuals/visual-factory-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-impl.cpp @@ -135,6 +135,7 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property break; } + default: // Default to Image type if unknown (check if there is a URL) case Toolkit::Visual::IMAGE: { Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME ); @@ -159,6 +160,13 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property } } } + else if( propertyMap.Find( Toolkit::Visual::Property::SHADER, CUSTOM_SHADER ) ) + { + // Create Image Visual if it has a shader + // TODO: This is required because of EffectsView which should be fixed + CreateAtlasManager(); + visualPtr = new ImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) ); + } break; } -- 2.7.4