From: Kimmo Hoikka Date: Wed, 19 Oct 2016 09:48:47 +0000 (+0100) Subject: Change SvgVisual to use Texture instead of Atlas X-Git-Tag: dali_1.2.11~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F08%2F92908%2F4;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Change SvgVisual to use Texture instead of Atlas Change-Id: Iaf47938f22e4cc11722b8aacdc144fb59338ea2d --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp b/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp index 40e37c9..3fe52b4 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp @@ -1139,6 +1139,46 @@ int UtcDaliVisualFactoryGetSvgVisual(void) END_TEST; } +int UtcDaliVisualFactoryGetSvgVisualLarge(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcDaliVisualFactoryGetSvgVisual: Request svg visual with a svg url" ); + + VisualFactory factory = VisualFactory::Get(); + Visual::Base visual = factory.CreateVisual( TEST_SVG_FILE_NAME, ImageDimensions( 2000, 2000 ) ); + DALI_TEST_CHECK( visual ); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& textureTrace = gl.GetTextureTrace(); + textureTrace.Enable(true); + + Actor actor = Actor::New(); + Stage::GetCurrent().Add( actor ); + visual.SetOnStage( actor ); + application.SendNotification(); + application.Render(); + + // renderer is not added to actor until the rasterization is completed. + DALI_TEST_CHECK( actor.GetRendererCount() == 0u ); + + EventThreadCallback* eventTrigger = EventThreadCallback::Get(); + CallbackBase* callback = eventTrigger->GetCallback(); + + eventTrigger->WaitingForTrigger( 1 );// waiting until the svg image is rasterized. + CallbackBase::Execute( *callback ); + + // renderer is added to actor + DALI_TEST_CHECK( actor.GetRendererCount() == 1u ); + + // waiting for the resource uploading + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION ); + + END_TEST; +} + //Creates a mesh visual from the given propertyMap and tries to load it on stage in the given application. //This is expected to succeed, which will then pass the test. void MeshVisualLoadsCorrectlyTest( Property::Map& propertyMap, ToolkitTestApplication& application ) diff --git a/dali-toolkit/internal/visuals/svg/svg-visual.cpp b/dali-toolkit/internal/visuals/svg/svg-visual.cpp index fec7797..46b6a62 100644 --- a/dali-toolkit/internal/visuals/svg/svg-visual.cpp +++ b/dali-toolkit/internal/visuals/svg/svg-visual.cpp @@ -228,8 +228,9 @@ void SvgVisual::ApplyRasterizedImage( PixelData rasterizedPixelData ) } else // no atlasing { - Atlas texture = Atlas::New( rasterizedPixelData.GetWidth(), rasterizedPixelData.GetHeight() ); - texture.Upload( rasterizedPixelData, 0, 0 ); + Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGBA8888, + rasterizedPixelData.GetWidth(), rasterizedPixelData.GetHeight() ); + texture.Upload( rasterizedPixelData ); mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED; if( mAtlasRect == FULL_TEXTURE_RECT ) @@ -247,7 +248,7 @@ void SvgVisual::ApplyRasterizedImage( PixelData rasterizedPixelData ) if( textureSet ) { - TextureSetImage( textureSet, 0u, texture ); + textureSet.SetTexture( 0, texture ); } }