/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
*/
// CLASS HEADER
-#include "loading-task.h"
+#include <dali-toolkit/internal/image-loader/loading-task.h>
// EXTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/image-loading.h>
#include <dali/devel-api/adaptor-framework/thread-settings.h>
#include <dali/integration-api/adaptor-framework/adaptor.h>
#include <dali/integration-api/debug.h>
+#include <dali/integration-api/trace.h>
#include <dali/public-api/adaptor-framework/encoded-image-buffer.h>
+#ifdef TRACE_ENABLED
+#include <sstream>
+#endif
+
namespace Dali
{
namespace Toolkit
{
namespace Internal
{
+namespace
+{
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_IMAGE_PERFORMANCE_MARKER, false);
+}
+
LoadingTask::LoadingTask(uint32_t id, Dali::AnimatedImageLoading animatedImageLoading, uint32_t frameIndex, DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad, CallbackBase* callback)
: AsyncTask(callback),
url(),
}
LoadingTask::LoadingTask(uint32_t id, const VisualUrl& url, ImageDimensions dimensions, FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection, DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad, bool loadPlanes, CallbackBase* callback)
-: AsyncTask(callback),
+: AsyncTask(callback, url.GetProtocolType() == VisualUrl::ProtocolType::REMOTE ? AsyncTask::PriorityType::LOW : AsyncTask::PriorityType::HIGH),
url(url),
encodedImageBuffer(),
id(id),
void LoadingTask::Process()
{
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream oss;
+ oss << "[url:" << (!!(animatedImageLoading) ? animatedImageLoading.GetUrl() : url.GetUrl()) << "]";
+ DALI_TRACE_BEGIN(gTraceFilter, "DALI_IMAGE_LOADING_TASK");
+ DALI_LOG_RELEASE_INFO("BEGIN: DALI_IMAGE_LOADING_TASK %s", oss.str().c_str());
+ }
+#endif
+
isReady = false;
if(!isMaskTask)
{
}
MultiplyAlpha();
isReady = true;
+
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream oss;
+ oss << "[";
+ oss << "masking:" << isMaskTask << " ";
+ oss << "index:" << frameIndex << " ";
+ oss << "pixelBuffers:" << pixelBuffers.size() << " ";
+ if(!pixelBuffers.empty())
+ {
+ oss << "size:" << pixelBuffers[0].GetWidth() << "x" << pixelBuffers[0].GetHeight() << " ";
+ oss << "premult:" << pixelBuffers[0].IsAlphaPreMultiplied() << " ";
+ }
+ oss << "url:" << (!!(animatedImageLoading) ? animatedImageLoading.GetUrl() : url.GetUrl()) << "]";
+ DALI_TRACE_END(gTraceFilter, "DALI_IMAGE_LOADING_TASK");
+ DALI_LOG_RELEASE_INFO("END: DALI_IMAGE_LOADING_TASK %s", oss.str().c_str());
+ }
+#endif
}
bool LoadingTask::IsReady()
else if(encodedImageBuffer)
{
pixelBuffer = Dali::LoadImageFromBuffer(encodedImageBuffer.GetRawBuffer(), dimensions, fittingMode, samplingMode, orientationCorrection);
+
+ // We don't need to hold image buffer anymore.
+ encodedImageBuffer.Reset();
}
else if(url.IsValid() && url.IsLocalResource())
{