Make to send EncodedImageBuffer from TextureManager to AsyncImageLoader directly.
Now we don't need to get standalone factory at AsyncImageLoader.
So we don't need fearful exception check
Change-Id: I9b903c6a446fc167d11bdf7e22e6c7e19d085cc5
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
// EXTERNAL INCLUDES
#include <dali/integration-api/adaptor-framework/adaptor.h>
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
-
namespace Dali
{
namespace Toolkit
mLoadThread.Start();
mIsLoadThreadStarted = true;
}
- if(url.IsBufferResource())
- {
- auto visualFactory = Toolkit::VisualFactory::Get();
- if(visualFactory)
- {
- // Get EncodedImageBuffer from texturemanager
- // and make new LoadingTask with buffer
- auto& textureManager = GetImplementation(visualFactory).GetTextureManager();
+ mLoadThread.AddTask(new LoadingTask(++mLoadTaskId, url, dimensions, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad));
- const EncodedImageBuffer& encodedBuffer = textureManager.GetEncodedImageBuffer(url.GetUrl());
+ return mLoadTaskId;
+}
- mLoadThread.AddTask(new LoadingTask(++mLoadTaskId, encodedBuffer, dimensions, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad));
- }
- }
- else
+uint32_t AsyncImageLoader::LoadEncodedImageBuffer(const EncodedImageBuffer& encodedImageBuffer,
+ ImageDimensions dimensions,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection,
+ DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad)
+{
+ if(!mIsLoadThreadStarted)
{
- mLoadThread.AddTask(new LoadingTask(++mLoadTaskId, url, dimensions, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad));
+ mLoadThread.Start();
+ mIsLoadThreadStarted = true;
}
+ mLoadThread.AddTask(new LoadingTask(++mLoadTaskId, encodedImageBuffer, dimensions, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad));
return mLoadTaskId;
}
DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
/**
+ * @brief Starts an image loading task by encoded image buffer.
+ * @param[in] encodedImageBuffer The encoded buffer of the image to load
+ * @param[in] dimensions The width and height to fit the loaded image to
+ * @param[in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter
+ * @param[in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size
+ * @param[in] orientationCorrection Reorient the image to respect any orientation metadata in its header
+ * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha.
+ * @return The loading task id
+ */
+ uint32_t LoadEncodedImageBuffer(const EncodedImageBuffer& encodedImageBuffer,
+ ImageDimensions dimensions,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection,
+ DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
+
+ /**
* @brief Starts an mask applying task.
* @param[in] pixelBuffer of the to be masked image
* @param[in] maskPixelBuffer of the mask image
DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad)
{
mLoadingInfoContainer.push_back(AsyncLoadingInfo(textureId));
- auto id = GetImplementation(mLoader).Load(url, desiredSize, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad);
- mLoadingInfoContainer.back().loadId = id;
+ if(DALI_UNLIKELY(url.IsBufferResource()))
+ {
+ auto id = GetImplementation(mLoader).LoadEncodedImageBuffer(mTextureManager.GetEncodedImageBuffer(url.GetUrl()), desiredSize, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad);
+ mLoadingInfoContainer.back().loadId = id;
+ }
+ else
+ {
+ auto id = GetImplementation(mLoader).Load(url, desiredSize, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad);
+ mLoadingInfoContainer.back().loadId = id;
+ }
}
void TextureManager::AsyncLoadingHelper::ApplyMask(TextureId textureId,