/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
SvgVisualPtr svgVisual( new SvgVisual( factoryCache, shaderFactory, imageUrl ) );
svgVisual->Load();
svgVisual->SetProperties(properties);
+ svgVisual->Initialize();
return svgVisual;
}
{
SvgVisualPtr svgVisual( new SvgVisual( factoryCache, shaderFactory, imageUrl ) );
svgVisual->Load();
+ svgVisual->Initialize();
return svgVisual;
}
{
}
+void SvgVisual::OnInitialize()
+{
+ Shader shader;
+ if(!mImpl->mCustomShader)
+ {
+ shader = mImageVisualShaderFactory.GetShader(mFactoryCache, mAttemptAtlasing, true, IsRoundedCornerRequired());
+ }
+ else
+ {
+ shader = Shader::New(mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource().data() : mImpl->mCustomShader->mVertexShader,
+ mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource().data() : mImpl->mCustomShader->mFragmentShader,
+ mImpl->mCustomShader->mHints);
+
+ shader.RegisterProperty(PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT);
+ }
+
+ Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
+ mImpl->mRenderer = Renderer::New(geometry, shader);
+}
+
void SvgVisual::DoSetProperties( const Property::Map& propertyMap )
{
// url already passed in from constructor
void SvgVisual::DoSetOnScene( Actor& actor )
{
- Shader shader;
- if( !mImpl->mCustomShader )
- {
- shader = mImageVisualShaderFactory.GetShader( mFactoryCache, mAttemptAtlasing, true, IsRoundedCornerRequired() );
- }
- else
- {
- shader = Shader::New( mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource().data() : mImpl->mCustomShader->mVertexShader,
- mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource().data() : mImpl->mCustomShader->mFragmentShader,
- mImpl->mCustomShader->mHints );
-
- shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
- }
-
- Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
TextureSet textureSet = TextureSet::New();
- mImpl->mRenderer = Renderer::New( geometry, shader );
mImpl->mRenderer.SetTextures( textureSet );
// Register transform properties
mFactoryCache.GetSVGRasterizationThread()->RemoveTask( this );
actor.RemoveRenderer( mImpl->mRenderer );
- mImpl->mRenderer.Reset();
mPlacementActor.Reset();
// Reset the visual size to zero so that when adding the actor back to stage the SVG rasterization is forced