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=7044e6d9106fea4673f9b063030dd8dc5bca27da;hp=594c12fd2479db09d9281959cee675f55752323d;hb=f36f8f52fba9353136846f4bcabbbb7a9e0401e7;hpb=5a6809a40da6a50d2edce9202466aa289ad96162 diff --git a/dali-toolkit/internal/visuals/visual-factory-cache.cpp b/dali-toolkit/internal/visuals/visual-factory-cache.cpp index 594c12f..7044e6d 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,18 +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"); -} +#include namespace Dali { @@ -43,7 +38,7 @@ namespace Internal VisualFactoryCache::VisualFactoryCache( bool preMultiplyOnLoad ) : mSvgRasterizeThread( NULL ), - mVectorAnimationThread(), + mVectorAnimationManager(), mBrokenImageUrl(""), mPreMultiplyOnLoad( preMultiplyOnLoad ) { @@ -136,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() @@ -223,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 )