X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-factory-cache.cpp;h=218ba4f3cc1ab8ac4df3e20fa4ea098a562d4ebb;hp=854a43acab3ba2359df551654e4b9fed242a275e;hb=01c086f17e2af89f6c6b1bd30a0240da2fda1e75;hpb=32fb8d43cf8802133910ad631a8278974a076317 diff --git a/dali-toolkit/internal/visuals/visual-factory-cache.cpp b/dali-toolkit/internal/visuals/visual-factory-cache.cpp index 854a43a..218ba4f 100644 --- a/dali-toolkit/internal/visuals/visual-factory-cache.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-cache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -19,12 +19,13 @@ // EXTERNAL INCLUDES #include -#include +#include // INTERNAL INCLUDES #include #include #include +#include namespace Dali { @@ -37,7 +38,7 @@ namespace Internal VisualFactoryCache::VisualFactoryCache( bool preMultiplyOnLoad ) : mSvgRasterizeThread( NULL ), - mVectorAnimationThread(), + mVectorAnimationManager(), mBrokenImageUrl(""), mPreMultiplyOnLoad( preMultiplyOnLoad ) { @@ -88,7 +89,7 @@ Geometry VisualFactoryCache::CreateQuadGeometry() Property::Map quadVertexFormat; quadVertexFormat["aPosition"] = Property::VECTOR2; - PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat ); + VertexBuffer quadVertices = VertexBuffer::New( quadVertexFormat ); quadVertices.SetData( quadVertexData, 4 ); // Create the geometry object @@ -130,14 +131,13 @@ SvgRasterizeThread* VisualFactoryCache::GetSVGRasterizationThread() return mSvgRasterizeThread; } -VectorAnimationThread& VisualFactoryCache::GetVectorAnimationThread() +VectorAnimationManager& VisualFactoryCache::GetVectorAnimationManager() { - if( !mVectorAnimationThread ) + if( !mVectorAnimationManager ) { - mVectorAnimationThread = std::unique_ptr< VectorAnimationThread >( new VectorAnimationThread() ); - mVectorAnimationThread->Start(); + mVectorAnimationManager = std::unique_ptr< VectorAnimationManager >( new VectorAnimationManager() ); } - return *mVectorAnimationThread; + return *mVectorAnimationManager; } void VisualFactoryCache::ApplyRasterizedSVGToSampler() @@ -193,20 +193,20 @@ Geometry VisualFactoryCache::CreateGridGeometry( Uint16Pair gridSize ) Property::Map vertexFormat; vertexFormat[ "aPosition" ] = Property::VECTOR2; - PropertyBuffer vertexPropertyBuffer = PropertyBuffer::New( vertexFormat ); + VertexBuffer vertexBuffer = VertexBuffer::New( vertexFormat ); if( vertices.Size() > 0 ) { - vertexPropertyBuffer.SetData( &vertices[ 0 ], vertices.Size() ); + vertexBuffer.SetData( &vertices[ 0 ], vertices.Size() ); } Property::Map indexFormat; indexFormat[ "indices" ] = Property::INTEGER; - PropertyBuffer indexPropertyBuffer = PropertyBuffer::New( indexFormat ); + VertexBuffer indexVertexBuffer = VertexBuffer::New( indexFormat ); // Create the geometry object Geometry geometry = Geometry::New(); - geometry.AddVertexBuffer( vertexPropertyBuffer ); + geometry.AddVertexBuffer( vertexBuffer ); if( indices.Size() > 0 ) { geometry.SetIndexBuffer( &indices[ 0 ], indices.Size() ); @@ -217,9 +217,21 @@ Geometry VisualFactoryCache::CreateGridGeometry( Uint16Pair gridSize ) return geometry; } -Image VisualFactoryCache::GetBrokenVisualImage() +Texture VisualFactoryCache::GetBrokenVisualImage() { - return ResourceImage::New( mBrokenImageUrl ); + if(!mBrokenImageTexture && mBrokenImageUrl.size()) + { + PixelData data; + Devel::PixelBuffer pixelBuffer = LoadImageFromFile( mBrokenImageUrl ); + if( pixelBuffer ) + { + data = Devel::PixelBuffer::Convert(pixelBuffer); // takes ownership of buffer + mBrokenImageTexture = Texture::New( Dali::TextureType::TEXTURE_2D, data.GetPixelFormat(), + data.GetWidth(), data.GetHeight() ); + mBrokenImageTexture.Upload( data ); + } + } + return mBrokenImageTexture; } void VisualFactoryCache::SetPreMultiplyOnLoad( bool preMultiply )