summaryrefslogtreecommitdiffstats
path: root/thirdparty/thorvg/src/renderer/tvgSwCanvas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/thorvg/src/renderer/tvgSwCanvas.cpp')
-rw-r--r--thirdparty/thorvg/src/renderer/tvgSwCanvas.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/thirdparty/thorvg/src/renderer/tvgSwCanvas.cpp b/thirdparty/thorvg/src/renderer/tvgSwCanvas.cpp
index 52d85d8320..d762492f22 100644
--- a/thirdparty/thorvg/src/renderer/tvgSwCanvas.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgSwCanvas.cpp
@@ -46,9 +46,9 @@ struct SwCanvas::Impl
/************************************************************************/
#ifdef THORVG_SW_RASTER_SUPPORT
-SwCanvas::SwCanvas() : Canvas(SwRenderer::gen()), pImpl(new Impl)
+SwCanvas::SwCanvas() : Canvas(SwRenderer::gen()), pImpl(nullptr)
#else
-SwCanvas::SwCanvas() : Canvas(nullptr), pImpl(new Impl)
+SwCanvas::SwCanvas() : Canvas(nullptr), pImpl(nullptr)
#endif
{
}
@@ -82,6 +82,10 @@ Result SwCanvas::mempool(MempoolPolicy policy) noexcept
Result SwCanvas::target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h, Colorspace cs) noexcept
{
#ifdef THORVG_SW_RASTER_SUPPORT
+ if (Canvas::pImpl->status != Status::Damanged && Canvas::pImpl->status != Status::Synced) {
+ return Result::InsufficientCondition;
+ }
+
//We know renderer type, avoid dynamic_cast for performance.
auto renderer = static_cast<SwRenderer*>(Canvas::pImpl->renderer);
if (!renderer) return Result::MemoryCorruption;
@@ -90,12 +94,12 @@ Result SwCanvas::target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t
Canvas::pImpl->vport = {0, 0, (int32_t)w, (int32_t)h};
renderer->viewport(Canvas::pImpl->vport);
- //Paints must be updated again with this new target.
- Canvas::pImpl->needRefresh();
-
//FIXME: The value must be associated with an individual canvas instance.
ImageLoader::cs = static_cast<ColorSpace>(cs);
+ //Paints must be updated again with this new target.
+ Canvas::pImpl->status = Status::Damanged;
+
return Result::Success;
#endif
return Result::NonSupport;