X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fimage-loader%2Fasync-image-loader-impl.cpp;h=912a4413623f655a308f8f44eb76bde84ac5ad0f;hp=06065b79262b424c97e158d296437dce966db0e1;hb=763c96a171fb79c5ae983792434537c70ac231fb;hpb=fc829906bc88730e08c8d483a351bd1a1ffc563f diff --git a/dali-toolkit/internal/image-loader/async-image-loader-impl.cpp b/dali-toolkit/internal/image-loader/async-image-loader-impl.cpp index 06065b7..912a441 100644 --- a/dali-toolkit/internal/image-loader/async-image-loader-impl.cpp +++ b/dali-toolkit/internal/image-loader/async-image-loader-impl.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,8 +19,7 @@ #include "async-image-loader-impl.h" // EXTERNAL INCLUDES -#include -#include +#include namespace Dali { @@ -50,21 +49,48 @@ IntrusivePtr AsyncImageLoader::New() return internal; } -uint32_t AsyncImageLoader::Load( const std::string& url, +uint32_t AsyncImageLoader::LoadAnimatedImage( Dali::AnimatedImageLoading animatedImageLoading, + uint32_t frameIndex ) +{ + if( !mIsLoadThreadStarted ) + { + mLoadThread.Start(); + mIsLoadThreadStarted = true; + } + mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, animatedImageLoading, frameIndex ) ); + + return mLoadTaskId; +} + +uint32_t AsyncImageLoader::Load( const VisualUrl& url, ImageDimensions dimensions, FittingMode::Type fittingMode, SamplingMode::Type samplingMode, - bool orientationCorrection ) + bool orientationCorrection, + DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad) { if( !mIsLoadThreadStarted ) { mLoadThread.Start(); mIsLoadThreadStarted = true; } + mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, url, dimensions, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad ) ); - BitmapLoader loader = BitmapLoader::New( url, dimensions, fittingMode, samplingMode, orientationCorrection ); + return mLoadTaskId; +} - mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, loader ) ); +uint32_t AsyncImageLoader::ApplyMask( Devel::PixelBuffer pixelBuffer, + Devel::PixelBuffer maskPixelBuffer, + float contentScale, + bool cropToMask, + DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad) +{ + if( !mIsLoadThreadStarted ) + { + mLoadThread.Start(); + mIsLoadThreadStarted = true; + } + mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, pixelBuffer, maskPixelBuffer, contentScale, cropToMask, preMultiplyOnLoad ) ); return mLoadTaskId; } @@ -74,6 +100,11 @@ Toolkit::AsyncImageLoader::ImageLoadedSignalType& AsyncImageLoader::ImageLoadedS return mLoadedSignal; } +Toolkit::DevelAsyncImageLoader::PixelBufferLoadedSignalType& AsyncImageLoader::PixelBufferLoadedSignal() +{ + return mPixelBufferLoadedSignal; +} + bool AsyncImageLoader::Cancel( uint32_t loadingTaskId ) { return mLoadThread.CancelTask( loadingTaskId ); @@ -86,9 +117,22 @@ void AsyncImageLoader::CancelAll() void AsyncImageLoader::ProcessLoadedImage() { - while( LoadingTask *next = mLoadThread.NextCompletedTask() ) + while( LoadingTask *next = mLoadThread.NextCompletedTask() ) { - mLoadedSignal.Emit( next->id, next->loader.GetPixelData() ); + if( mPixelBufferLoadedSignal.GetConnectionCount() > 0 ) + { + mPixelBufferLoadedSignal.Emit( next->id, next->pixelBuffer ); + } + else if( mLoadedSignal.GetConnectionCount() > 0 ) + { + PixelData pixelData; + if( next->pixelBuffer ) + { + pixelData = Devel::PixelBuffer::Convert( next->pixelBuffer ); + } + mLoadedSignal.Emit( next->id, pixelData ); + } + delete next; } }