If thorvg is used by multiple processes it can't be guaranteed that particular
amount of threads will be used. Especially if we choose to work synchronously,
another process may force it to run asynchronously.
This patch changes copy parameter of load() to true, so to assure that in case
of asynchronous execution the data will not be released before the vector
image loaded.
It also adds printing of the return code in case of mSwCanvas->draw() failure.
Change-Id: I539323768d9fa0be0aeb165b161086973efddd8b
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mSwCanvas = tvg::SwCanvas::gen();
mSwCanvas->mempool(tvg::SwCanvas::MempoolPolicy::Individual);
mSwCanvas = tvg::SwCanvas::gen();
mSwCanvas->mempool(tvg::SwCanvas::MempoolPolicy::Individual);
- mSwCanvas->reserve(1); //has one picture
+ mSwCanvas->reserve(1); //has one picture
- mRasterizer = nsvgCreateRasterizer();
+ mRasterizer = nsvgCreateRasterizer();
- tvg::Result ret = mPicture->load(reinterpret_cast<char*>(data.Begin()), data.Size(), false);
+ tvg::Result ret = mPicture->load(reinterpret_cast<char*>(data.Begin()), data.Size(), true);
if(ret != tvg::Result::Success)
{
if(ret != tvg::Result::Success)
{
{
case tvg::Result::InvalidArguments:
{
{
case tvg::Result::InvalidArguments:
{
float w, h;
mPicture->size(&w, &h);
float w, h;
mPicture->size(&w, &h);
- mDefaultWidth = static_cast<uint32_t>(w);
+ mDefaultWidth = static_cast<uint32_t>(w);
mDefaultHeight = static_cast<uint32_t>(h);
return true;
mDefaultHeight = static_cast<uint32_t>(h);
return true;
- auto width = buffer.GetWidth();
+ auto width = buffer.GetWidth();
auto height = buffer.GetHeight();
mSwCanvas->target(reinterpret_cast<uint32_t*>(pBuffer), width, width, height, tvg::SwCanvas::ABGR8888);
auto height = buffer.GetHeight();
mSwCanvas->target(reinterpret_cast<uint32_t*>(pBuffer), width, width, height, tvg::SwCanvas::ABGR8888);
- if(mSwCanvas->draw() != tvg::Result::Success)
+ auto ret = mSwCanvas->draw();
+ if(ret != tvg::Result::Success)
- DALI_LOG_ERROR("VectorImageRenderer::Rasterize: Draw fail [%p]\n", this);
+ DALI_LOG_ERROR("VectorImageRenderer::Rasterize: Draw fail %d [%p]\n", static_cast<int>(ret), this);
void VectorImageRenderer::GetDefaultSize(uint32_t& width, uint32_t& height) const
{
#ifdef THORVG_SUPPORT
void VectorImageRenderer::GetDefaultSize(uint32_t& width, uint32_t& height) const
{
#ifdef THORVG_SUPPORT
height = mDefaultHeight;
#else
if(mParsedImage)
height = mDefaultHeight;
#else
if(mParsedImage)