return true;
}
+ bool Load(const Dali::Vector<uint8_t>& data)
+ {
+ Dali::Mutex::ScopedLock lock(mMutex);
+
+ mDefaultWidth = 100;
+ mDefaultHeight = 100;
+
+ return true;
+ }
+
void SetRenderer(Dali::Renderer renderer)
{
mRenderer = renderer;
return Internal::Adaptor::GetImplementation(*this).Load(url);
}
+bool VectorAnimationRenderer::Load(const Dali::Vector<uint8_t>& data)
+{
+ return Internal::Adaptor::GetImplementation(*this).Load(data);
+}
+
void VectorAnimationRenderer::SetRenderer(Renderer renderer)
{
Internal::Adaptor::GetImplementation(*this).SetRenderer(renderer);
#include <dali-toolkit/public-api/image-loader/image-url.h>
#include <dali-toolkit/public-api/image-loader/image.h>
+#include <dali/devel-api/adaptor-framework/native-image-source-queue.h>
#include <dali/public-api/adaptor-framework/native-image-source.h>
#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/rendering/frame-buffer.h>
END_TEST;
}
+int UtcDaliImageConvertNativeImageInterfaceToUrl01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliImageConvertNativeImageInterfaceToUrl01");
+
+ unsigned int width(64);
+ unsigned int height(64);
+ try
+ {
+ NativeImageSourceQueuePtr nativeImageQueue = NativeImageSourceQueue::New(width, height, (Dali::NativeImageSourceQueue::ColorFormat::BGR888));
+
+ DALI_TEST_CHECK(Dali::Toolkit::Image::GenerateUrl(nativeImageQueue).GetUrl().size() > 0u);
+ }
+ catch(Dali::DaliException& e)
+ {
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "Adaptor::IsAvailable()", TEST_LOCATION);
+ }
+ catch(...)
+ {
+ tet_printf("Assertion test failed - wrong Exception\n");
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliImageConvertNativeImageInterfaceToUrl02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliImageConvertNativeImageInterfaceToUrl02");
+
+ unsigned int width(64);
+ unsigned int height(64);
+ try
+ {
+ NativeImageSourceQueuePtr nativeImageQueue = NativeImageSourceQueue::New(width, height, (Dali::NativeImageSourceQueue::ColorFormat::BGR888));
+
+ DALI_TEST_CHECK(Dali::Toolkit::Image::GenerateUrl(nativeImageQueue, true).GetUrl().size() > 0u);
+ }
+ catch(Dali::DaliException& e)
+ {
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "Adaptor::IsAvailable()", TEST_LOCATION);
+ }
+ catch(...)
+ {
+ tet_printf("Assertion test failed - wrong Exception\n");
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
int UtcDaliImageConvertEncodedImageBufferToUrl(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int UtcDaliImageVisualWithPixelDataMasking02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("Load premultiplied external texture with mask");
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ uint32_t width(64);
+ uint32_t height(64);
+ uint32_t bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::RGBA8888);
+
+ uint8_t* buffer = reinterpret_cast<uint8_t*>(malloc(bufferSize));
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE);
+
+ DALI_TEST_CHECK(pixelData);
+
+ ImageUrl imageUrl = Dali::Toolkit::Image::GenerateUrl(pixelData, true);
+ std::string url = imageUrl.GetUrl();
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK(factory);
+
+ Property::Map propertyMap;
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::IMAGE);
+ propertyMap.Insert(ImageVisual::Property::URL, url);
+ propertyMap.Insert(ImageVisual::Property::ALPHA_MASK_URL, TEST_MASK_IMAGE_FILE_NAME);
+
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ Property::Map testMap;
+ visual.CreatePropertyMap(testMap);
+ DALI_TEST_EQUALS(*testMap.Find(ImageVisual::Property::ALPHA_MASK_URL), Property::Value(TEST_MASK_IMAGE_FILE_NAME), TEST_LOCATION);
+
+ DummyControl actor = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual(Control::CONTROL_PROPERTY_END_INDEX + 1, visual);
+
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
+
+ application.GetScene().Add(actor);
+ application.SendNotification();
+ application.Render(16);
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.IsResourceReady(), true, TEST_LOCATION);
+
+ Renderer renderer = actor.GetRendererAt(0);
+
+ //Check visual property
+ DALI_TEST_EQUALS(*testMap.Find(Visual::Property::PREMULTIPLIED_ALPHA), Property::Value(true), TEST_LOCATION);
+
+ // Check whether preMultipliedAlpha is true.
+ auto preMultipliedAlpha = renderer.GetProperty<bool>(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+ DALI_TEST_EQUALS(preMultipliedAlpha, true, TEST_LOCATION);
+
+ dummyImpl.UnregisterVisual(Control::CONTROL_PROPERTY_END_INDEX + 1);
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliImageVisualWithPixelDataMaskingSynchronously(void)
{
ToolkitTestApplication application;
void TextField::OnTap(const TapGesture& gesture)
{
DALI_LOG_INFO(gTextFieldLogFilter, Debug::Verbose, "TextField::OnTap %p\n", mController.Get());
- if(mInputMethodContext && IsEditable())
- {
- mInputMethodContext.Activate();
- }
+
// Deliver the tap before the focus event to controller; this allows us to detect when focus is gained due to tap-gestures
Extents padding;
padding = Self().GetProperty<Extents>(Toolkit::Control::Property::PADDING);
{
std::ostringstream oss;
oss << "[";
- oss << "pixelBuffers: " << pixelBuffers.size() << " ";
+ oss << "pixelBuffers:" << pixelBuffers.size() << " ";
if(!pixelBuffers.empty())
{
+ oss << "size:" << pixelBuffers[0].GetWidth() << "x" << pixelBuffers[0].GetHeight() << " ";
oss << "premult:" << mPremultiplied << " ";
}
oss << "url:" << mUrl.GetUrl() << "]";
std::ostringstream oss;
oss << "[";
oss << "masking:" << isMaskTask << " ";
- oss << "index: " << frameIndex << " ";
- oss << "pixelBuffers: " << pixelBuffers.size() << " ";
+ 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()) << "]";
{
if(textureInfo.loadState != LoadState::UPLOADED)
{
+ textureInfo.preMultiplied = (preMultiplyOnLoad == TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD);
textureInfo.loadState = TextureManager::LoadState::WAITING_FOR_MASK;
}
}
bool preMultiplyOnLoad)
: ImageCache(textureManager, size, fittingMode, samplingMode, maskingData, observer, batchSize, interval, preMultiplyOnLoad),
mImageUrls(urlList),
- mFront(FIRST_FRAME_INDEX)
+ mCurrentFrameIndex(FIRST_FRAME_INDEX)
{
mReadyFlags.reserve(mImageUrls.size());
}
}
while(mReadyFlags.size() < mImageUrls.size() &&
- (frameIndex > mFront || mReadyFlags.empty()))
+ (frameIndex > mCurrentFrameIndex || mReadyFlags.empty()))
{
- ++mFront;
+ ++mCurrentFrameIndex;
LoadBatch();
}
- mFront = frameIndex;
+ mCurrentFrameIndex = frameIndex;
- if(IsFrontReady() && mLoadState != TextureManager::LoadState::LOAD_FAILED)
+ if(IsFrameReady(mCurrentFrameIndex) && mLoadState != TextureManager::LoadState::LOAD_FAILED)
{
- textureSet = GetFrontTextureSet();
+ textureSet = GetTextureSet(mCurrentFrameIndex);
}
return textureSet;
int32_t FixedImageCache::GetCurrentFrameIndex() const
{
- return static_cast<int32_t>(mFront);
+ return static_cast<int32_t>(mCurrentFrameIndex);
}
int32_t FixedImageCache::GetTotalFrameCount() const
return mImageUrls.size();
}
-bool FixedImageCache::IsFrontReady() const
+bool FixedImageCache::IsFrameReady(uint32_t frameIndex) const
{
- return (mReadyFlags.size() > 0 && mReadyFlags[mFront] == true);
+ return (mReadyFlags.size() > 0 && mReadyFlags[frameIndex] == true);
}
void FixedImageCache::LoadBatch()
}
}
-TextureSet FixedImageCache::GetFrontTextureSet() const
+TextureSet FixedImageCache::GetTextureSet(uint32_t frameIndex) const
{
- TextureSet textureSet = mTextureManager.GetTextureSet(mImageUrls[mFront].mTextureId);
+ TextureSet textureSet = mTextureManager.GetTextureSet(mImageUrls[frameIndex].mTextureId);
if(textureSet)
{
Sampler sampler = Sampler::New();
return textureSet;
}
-void FixedImageCache::CheckFrontFrame(bool wasReady, bool preMultiplied)
+void FixedImageCache::MakeReady(bool wasReady, uint32_t frameIndex, bool preMultiplied)
{
- if(wasReady == false && IsFrontReady())
+ if(wasReady == false && IsFrameReady(frameIndex))
{
- mObserver.FrameReady(GetFrontTextureSet(), mInterval, preMultiplied);
+ mObserver.FrameReady(GetTextureSet(frameIndex), mInterval, preMultiplied);
}
}
if(loadSuccess)
{
mLoadState = TextureManager::LoadState::LOAD_FINISHED;
- bool frontFrameReady = IsFrontReady();
+ bool isCurrentFrameReady = IsFrameReady(mCurrentFrameIndex);
if(!mRequestingLoad)
{
for(std::size_t i = 0; i < mImageUrls.size(); ++i)
{
mReadyFlags.back() = true;
}
- CheckFrontFrame(frontFrameReady, textureInformation.preMultiplied);
+ MakeReady(isCurrentFrameReady, mCurrentFrameIndex, textureInformation.preMultiplied);
}
else
{
private:
/**
- * @brief Check whether the front frame is ready or not.
+ * @brief Check whether the frame is ready or not.
+ * @param[in] frameIndex The frame index to check the frame is ready or not.
*
- * @return true if the front frame is ready
+ * @return true if the frame is ready
*/
- bool IsFrontReady() const;
+ bool IsFrameReady(uint32_t frameIndex) const;
/**
* @brief Load the next batch of images
void LoadBatch();
/**
- * @brief Get the texture set of the front frame.
+ * @brief Get the texture set at the input frame index
+ * @param[in] frameIndex The frame index to retrieve texture set.
*
* @return the texture set of the front of Cache.
*/
- TextureSet GetFrontTextureSet() const;
+ TextureSet GetTextureSet(uint32_t frameIndex) const;
/**
* @brief Check if the front frame has become ready - if so, inform observer
*
* @param[in] wasReady Readiness before call.
+ * @param[in] frameIndex The frame index for this frame
* @param[in] preMultiplied whether the texture is premultied alpha or not.
*/
- void CheckFrontFrame(bool wasReady, bool preMultiplied);
+ void MakeReady(bool wasReady, uint32_t frameIndex, bool preMultiplied);
protected:
/**
std::vector<UrlStore>& mImageUrls;
std::vector<bool> mReadyFlags;
std::vector<TextureManager::LoadState> mLoadStates;
- uint32_t mFront;
+ uint32_t mCurrentFrameIndex;
};
} //namespace Internal
AnimatedVectorImageVisual::AnimatedVectorImageVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, ImageDimensions size)
: Visual::Base(factoryCache, Visual::FittingMode::FILL, static_cast<Toolkit::Visual::Type>(Toolkit::DevelVisual::ANIMATED_VECTOR_IMAGE)),
- mUrl(imageUrl),
+ mImageUrl(imageUrl),
mAnimationData(),
mVectorAnimationTask(new VectorAnimationTask(factoryCache)),
mImageVisualShaderFactory(shaderFactory),
{
map.Clear();
map.Insert(Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::ANIMATED_VECTOR_IMAGE);
- if(mUrl.IsValid())
+ if(mImageUrl.IsValid())
{
- map.Insert(Toolkit::ImageVisual::Property::URL, mUrl.GetUrl());
+ map.Insert(Toolkit::ImageVisual::Property::URL, mImageUrl.GetUrl());
}
map.Insert(Toolkit::DevelImageVisual::Property::LOOP_COUNT, mAnimationData.loopCount);
mVectorAnimationTask->ResourceReadySignal().Connect(this, &AnimatedVectorImageVisual::OnResourceReady);
mVectorAnimationTask->SetAnimationFinishedCallback(MakeCallback(this, &AnimatedVectorImageVisual::OnAnimationFinished));
- mVectorAnimationTask->RequestLoad(mUrl.GetUrl(), IsSynchronousLoadingRequired());
+ mVectorAnimationTask->RequestLoad(mImageUrl, IsSynchronousLoadingRequired());
auto& vectorAnimationManager = mFactoryCache.GetVectorAnimationManager();
vectorAnimationManager.AddObserver(*this);
#define DALI_TOOLKIT_INTERNAL_ANIMATED_VECTOR_IMAGE_VISUAL_H
/*
- * 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.
AnimatedVectorImageVisual& operator=(const AnimatedVectorImageVisual& visual) = delete;
private:
- VisualUrl mUrl;
+ VisualUrl mImageUrl;
VectorAnimationTask::AnimationData mAnimationData;
VectorAnimationTaskPtr mVectorAnimationTask;
ImageVisualShaderFactory& mImageVisualShaderFactory;
VectorAnimationTask::VectorAnimationTask(VisualFactoryCache& factoryCache)
: AsyncTask(MakeCallback(this, &VectorAnimationTask::TaskCompleted), AsyncTask::PriorityType::HIGH, AsyncTask::ThreadType::WORKER_THREAD),
- mUrl(),
+ mImageUrl(),
mVectorRenderer(VectorAnimationRenderer::New()),
mAnimationData(),
mVectorAnimationThread(factoryCache.GetVectorAnimationManager().GetVectorAnimationThread()),
bool VectorAnimationTask::Load(bool synchronousLoading)
{
- DALI_TRACE_SCOPE(gTraceFilter, "DALI_LOTTIE_LOADING_TASK");
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream oss;
+ oss << "[url:" << mImageUrl.GetUrl() << "]";
+ DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_LOTTIE_LOADING_TASK", oss.str().c_str());
+ }
+#endif
+
+ if(!mVectorRenderer.Load(mImageUrl.GetUrl()))
+ {
+ DALI_LOG_ERROR("VectorAnimationTask::Load: Load failed [%s]\n", mImageUrl.GetUrl().c_str());
+ mLoadFailed = true;
+ }
- if(!mVectorRenderer.Load(mUrl))
+ if(mLoadFailed)
{
- DALI_LOG_ERROR("VectorAnimationTask::Load: Load failed [%s]\n", mUrl.c_str());
mLoadRequest = false;
- mLoadFailed = true;
if(!synchronousLoading && mLoadCompletedCallback)
{
mVectorAnimationThread.AddEventTriggerCallback(mLoadCompletedCallback.get());
}
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream oss;
+ oss << "[url:" << mImageUrl.GetUrl() << "]";
+ DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_LOTTIE_LOADING_TASK", oss.str().c_str());
+ }
+#endif
return false;
}
mVectorAnimationThread.AddEventTriggerCallback(mLoadCompletedCallback.get());
}
- DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::Load: file = %s [%d frames, %f fps] [%p]\n", mUrl.c_str(), mTotalFrame, mFrameRate, this);
+ DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::Load: file = %s [%d frames, %f fps] [%p]\n", mImageUrl.GetUrl().c_str(), mTotalFrame, mFrameRate, this);
+
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream oss;
+ oss << "[url:" << mImageUrl.GetUrl() << "]";
+ DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_LOTTIE_LOADING_TASK", oss.str().c_str());
+ }
+#endif
return true;
}
DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetRenderer [%p]\n", this);
}
-void VectorAnimationTask::RequestLoad(const std::string& url, bool synchronousLoading)
+void VectorAnimationTask::RequestLoad(const VisualUrl& url, bool synchronousLoading)
{
- mUrl = url;
+ mImageUrl = url;
if(!synchronousLoading)
{
mCurrentFrame = mEndFrame;
}
- DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetPlayRange: [%d, %d] [%s] [%p]\n", mStartFrame, mEndFrame, mUrl.c_str(), this);
+ DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetPlayRange: [%d, %d] [%s] [%p]\n", mStartFrame, mEndFrame, mImageUrl.GetUrl().c_str(), this);
}
}
return false;
}
- DALI_TRACE_BEGIN(gTraceFilter, "DALI_LOTTIE_RASTERIZE_TASK");
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream oss;
+ oss << "[size:" << mWidth << "x" << mHeight << " ";
+ oss << "url:" << mImageUrl.GetUrl() << "]";
+ DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_LOTTIE_RASTERIZE_TASK", oss.str().c_str());
+ }
+#endif
ApplyAnimationData();
if(gTraceFilter && gTraceFilter->IsTraceEnabled())
{
std::ostringstream oss;
- oss << "[size: " << mWidth << " x " << mHeight << ", ";
- oss << "frame: " << mCurrentFrame << ", ";
- oss << "loop: " << mCurrentLoop << ", ";
- oss << "state : " << mPlayState << "]";
+ oss << "[size:" << mWidth << "x" << mHeight << " ";
+ oss << "frame:" << mCurrentFrame << " ";
+ oss << "loop:" << mCurrentLoop << " ";
+ oss << "state:" << mPlayState << " ";
+ oss << "url:" << mImageUrl.GetUrl() << "]";
DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_LOTTIE_RASTERIZE_TASK", oss.str().c_str());
}
#endif
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-actions-devel.h>
#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
+#include <dali-toolkit/internal/visuals/visual-url.h>
namespace Dali
{
* @param[in] url The url of the vector animation file
* @param[in] synchronousLoading True if the url should be loaded synchronously
*/
- void RequestLoad(const std::string& url, bool synchronousLoading);
+ void RequestLoad(const VisualUrl& url, bool synchronousLoading);
/**
* @brief Queries whether loading is requested.
PAUSED ///< The animation is paused
};
- std::string mUrl;
+ VisualUrl mImageUrl;
VectorAnimationRenderer mVectorRenderer;
std::vector<AnimationData> mAnimationData[2];
VectorAnimationThread& mVectorAnimationThread;
SvgLoadingTask::SvgLoadingTask(VectorImageRenderer vectorRenderer, const VisualUrl& url, float dpi, CallbackBase* callback)
: SvgTask(vectorRenderer, callback, url.GetProtocolType() == VisualUrl::ProtocolType::REMOTE ? AsyncTask::PriorityType::LOW : AsyncTask::PriorityType::HIGH),
- mUrl(url),
+ mImageUrl(url),
mDpi(dpi)
{
}
return;
}
- DALI_TRACE_SCOPE(gTraceFilter, "DALI_SVG_LOADING_TASK");
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream oss;
+ oss << "[url:" << mImageUrl.GetUrl() << "]";
+ DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_SVG_LOADING_TASK", oss.str().c_str());
+ }
+#endif
+
+ bool loadFailed = false;
Dali::Vector<uint8_t> buffer;
- if(!mUrl.IsLocalResource())
+ if(!mImageUrl.IsLocalResource())
{
- if(!Dali::FileLoader::DownloadFileSynchronously(mUrl.GetUrl(), buffer))
+ if(!Dali::FileLoader::DownloadFileSynchronously(mImageUrl.GetUrl(), buffer))
{
- DALI_LOG_ERROR("Failed to download file! [%s]\n", mUrl.GetUrl().c_str());
- return;
+ DALI_LOG_ERROR("Failed to download file! [%s]\n", mImageUrl.GetUrl().c_str());
+ loadFailed = true;
}
}
else
{
- if(!Dali::FileLoader::ReadFile(mUrl.GetUrl(), buffer))
+ if(!Dali::FileLoader::ReadFile(mImageUrl.GetUrl(), buffer))
{
- DALI_LOG_ERROR("Failed to read file! [%s]\n", mUrl.GetUrl().c_str());
- return;
+ DALI_LOG_ERROR("Failed to read file! [%s]\n", mImageUrl.GetUrl().c_str());
+ loadFailed = true;
}
}
- buffer.PushBack('\0');
-
- if(!mVectorRenderer.Load(buffer, mDpi))
+ if(!loadFailed)
{
- DALI_LOG_ERROR("Failed to load data! [%s]\n", mUrl.GetUrl().c_str());
- return;
+ buffer.PushBack('\0');
+
+ if(!mVectorRenderer.Load(buffer, mDpi))
+ {
+ DALI_LOG_ERROR("Failed to load data! [%s]\n", mImageUrl.GetUrl().c_str());
+ loadFailed = true;
+ }
}
- mHasSucceeded = true;
+ mHasSucceeded = !loadFailed;
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream oss;
+ oss << "[success:" << mHasSucceeded << " ";
+ oss << "url:" << mImageUrl.GetUrl() << "]";
+ DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_SVG_LOADING_TASK", oss.str().c_str());
+ }
+#endif
}
bool SvgLoadingTask::IsReady()
if(gTraceFilter && gTraceFilter->IsTraceEnabled())
{
std::ostringstream oss;
- oss << "[size: " << mWidth << " x " << mHeight << "]";
+ oss << "[size:" << mWidth << "x" << mHeight << " ";
+ oss << "url:" << mImageUrl.GetUrl() << "]";
DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_SVG_RASTERIZE_TASK", oss.str().c_str());
}
#endif
if(!pixelBuffer)
{
DALI_LOG_ERROR("Rasterize is failed!\n");
- DALI_TRACE_END(gTraceFilter, "DALI_SVG_RASTERIZE_TASK");
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream oss;
+ oss << "[size:" << mWidth << "x" << mHeight << " ";
+ oss << "url:" << mImageUrl.GetUrl() << "]";
+ DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_SVG_RASTERIZE_TASK", oss.str().c_str());
+ }
+#endif
return;
}
mPixelData = Devel::PixelBuffer::Convert(pixelBuffer);
mHasSucceeded = true;
- DALI_TRACE_END(gTraceFilter, "DALI_SVG_RASTERIZE_TASK");
+
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream oss;
+ oss << "[size:" << mWidth << "x" << mHeight << " ";
+ oss << "url:" << mImageUrl.GetUrl() << "]";
+ DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_SVG_RASTERIZE_TASK", oss.str().c_str());
+ }
+#endif
}
bool SvgRasterizingTask::IsReady()
SvgLoadingTask& operator=(const SvgLoadingTask& task) = delete;
private:
- VisualUrl mUrl;
+ VisualUrl mImageUrl;
float mDpi;
};
*/
PixelData GetPixelData() const override;
+#ifdef TRACE_ENABLED
+ /**
+ * Set the url of rasterizatoin visual. Only for tracing
+ * @param[in] url The url of this visual
+ */
+ void SetUrl(VisualUrl url)
+ {
+ mImageUrl = std::move(url);
+ }
+#endif
+
private:
// Undefined
SvgRasterizingTask(const SvgRasterizingTask& task) = delete;
SvgRasterizingTask& operator=(const SvgRasterizingTask& task) = delete;
private:
+#ifdef TRACE_ENABLED
+ VisualUrl mImageUrl{};
+#endif
PixelData mPixelData;
uint32_t mWidth;
uint32_t mHeight;
mRasterizingTask = new SvgRasterizingTask(mVectorRenderer, width, height, MakeCallback(this, &SvgVisual::ApplyRasterizedImage));
+#ifdef TRACE_ENABLED
+ reinterpret_cast<SvgRasterizingTask*>(mRasterizingTask.Get())->SetUrl(mImageUrl);
+#endif
+
if(IsSynchronousLoadingRequired() && mImageUrl.IsLocalResource())
{
mRasterizingTask->Process();
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 50;
+const unsigned int TOOLKIT_MICRO_VERSION = 51;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
return imageUrl;
}
-Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource, bool preMultiplied)
+Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageInterfacePtr nativeImageInterface, bool preMultiplied)
{
- Texture texture = Dali::Texture::New(*nativeImageSource);
+ Texture texture = Dali::Texture::New(*nativeImageInterface);
Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture, preMultiplied);
return imageUrl;
}
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/adaptor-framework/native-image-source.h>
#include <dali/public-api/adaptor-framework/encoded-image-buffer.h>
+#include <dali/public-api/images/native-image-interface.h>
#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/rendering/frame-buffer.h>
{
/**
* API to interface with the toolkit image
- * Allows developers to add FrameBuffer, PixelData and NativeImageSource to toolkit so that visuals can use them to render
+ * Allows developers to add FrameBuffer, PixelData and NativeImageInterface to toolkit so that visuals can use them to render
*/
namespace Image
{
DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData, bool preMultiplied = false);
/**
- * @brief Generate a Url from native image source.
- * This Url can be used in visuals to render the native image source.
- * @note This method does not check for duplicates, If same native image source is entered multiple times, a different URL is returned each time.
- * @param[in] nativeImageSource the native image source to converted to Url
- * @param[in] preMultiplied Whether this native image source preMultiplied or not. Default as false.
- * @return the ImageUrl representing this native image source
+ * @brief Generate a Url from native image interface.
+ * This Url can be used in visuals to render the native image interface.
+ * @note This method does not check for duplicates, If same native image interface is entered multiple times, a different URL is returned each time.
+ * @param[in] nativeImageInterface the native image interface to converted to Url
+ * @param[in] preMultiplied Whether this native image interface preMultiplied or not. Default as false.
+ * @return the ImageUrl representing this native image interface
*/
-DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource, bool preMultiplied = false);
+DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageInterfacePtr nativeImageInterface, bool preMultiplied = false);
/**
* @brief Generate a Url from encoded image buffer.
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.2.50
+Version: 2.2.51
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT