From: Adeel Kazmi Date: Thu, 10 Nov 2016 17:41:07 +0000 (+0000) Subject: Register Transform uniforms in SVG Visual & only register shader properties upon... X-Git-Tag: dali_1.2.14~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea53884fdf98d37648819ca9a7855569e1a80cd9;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Register Transform uniforms in SVG Visual & only register shader properties upon their creation Fixes bug where SVG visuals are not being displayed. We are using the same shaders as in ImageVisual so need to register the same uniforms. Additionally, Image Shader properties only need to be registered upon creation rather than every time we get the Shader. Change-Id: Id74630ddb8e3beb34d582336172afae82fdf6db0 --- diff --git a/dali-toolkit/internal/visuals/image/image-visual.cpp b/dali-toolkit/internal/visuals/image/image-visual.cpp index d4d7e19..54527de 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/image-visual.cpp @@ -728,6 +728,7 @@ Shader ImageVisual::GetImageShader( VisualFactoryCache& factoryCache, bool atlas if( !shader ) { shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_ATLAS_CLAMP ); + shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT ); factoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_DEFAULT_WRAP, shader ); } } @@ -737,6 +738,7 @@ Shader ImageVisual::GetImageShader( VisualFactoryCache& factoryCache, bool atlas if( !shader ) { shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_ATLAS_VARIOUS_WRAP ); + shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT ); factoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_CUSTOM_WRAP, shader ); } } @@ -747,10 +749,11 @@ Shader ImageVisual::GetImageShader( VisualFactoryCache& factoryCache, bool atlas if( !shader ) { shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_NO_ATLAS ); + shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT ); factoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER, shader ); } } - shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT ); + return shader; } diff --git a/dali-toolkit/internal/visuals/svg/svg-visual.cpp b/dali-toolkit/internal/visuals/svg/svg-visual.cpp index e7c7aa8..8a390d4 100644 --- a/dali-toolkit/internal/visuals/svg/svg-visual.cpp +++ b/dali-toolkit/internal/visuals/svg/svg-visual.cpp @@ -98,6 +98,9 @@ void SvgVisual::DoSetOnStage( Actor& actor ) mImpl->mRenderer = Renderer::New( geometry, shader ); mImpl->mRenderer.SetTextures( textureSet ); + // Register transform properties + mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT ); + if( mImpl->mSize != Vector2::ZERO && mParsedImage ) { AddRasterizationTask( mImpl->mSize ); @@ -180,7 +183,6 @@ void SvgVisual::AddRasterizationTask( const Vector2& size ) { unsigned int width = static_cast(size.width); unsigned int height = static_cast( size.height ); - BufferImage image = BufferImage::New( width, height, Pixel::RGBA8888); RasterizingTaskPtr newTask = new RasterizingTask( this, mParsedImage, width, height ); mFactoryCache.GetSVGRasterizationThread()->AddTask( newTask );