X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-factory-cache.cpp;h=2db3a5775da08867a2c4bd244d1cc68ba46b0942;hb=e25442b0c940c46d7ae4ae2e7fb48688665d69e8;hp=101e6968f8384d444714c86748d93775e88d2bfe;hpb=e37f48bb34e81585a6ed436bd7a2f9dce02c19f5;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/visual-factory-cache.cpp b/dali-toolkit/internal/visuals/visual-factory-cache.cpp index 101e696..2db3a57 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,19 +19,13 @@ // EXTERNAL INCLUDES #include -#include +#include // INTERNAL INCLUDES #include #include #include - -namespace -{ -const char * const BROKEN_VISUAL_IMAGE_URL( DALI_IMAGE_DIR "broken.png"); -} - namespace Dali { @@ -43,6 +37,7 @@ namespace Internal VisualFactoryCache::VisualFactoryCache( bool preMultiplyOnLoad ) : mSvgRasterizeThread( NULL ), + mVectorAnimationThread(), mBrokenImageUrl(""), mPreMultiplyOnLoad( preMultiplyOnLoad ) { @@ -135,11 +130,21 @@ SvgRasterizeThread* VisualFactoryCache::GetSVGRasterizationThread() return mSvgRasterizeThread; } +VectorAnimationThread& VisualFactoryCache::GetVectorAnimationThread() +{ + if( !mVectorAnimationThread ) + { + mVectorAnimationThread = std::unique_ptr< VectorAnimationThread >( new VectorAnimationThread() ); + mVectorAnimationThread->Start(); + } + return *mVectorAnimationThread; +} + void VisualFactoryCache::ApplyRasterizedSVGToSampler() { while( RasterizingTaskPtr task = mSvgRasterizeThread->NextCompletedTask() ) { - task->GetSvgVisual()->ApplyRasterizedImage( task->GetPixelData() ); + task->GetSvgVisual()->ApplyRasterizedImage( task->GetParsedImage(), task->GetPixelData() ); } } @@ -212,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 )