From 81e6471071170ea2b37ae0e127ac16e77acffcfc Mon Sep 17 00:00:00 2001 From: Michal Maciola Date: Tue, 28 Sep 2021 13:15:24 +0200 Subject: [PATCH] common: allow composition on empty scene without insufficient condition error If there was an empty scene (empty scene, so bounds equal zero) with a mask composition applied, Paint::Impl::render failed on checking size and Canvas::draw() returned InsufficientCondition. As a result no other paints was rendered. @issue: fixes #842 --- src/lib/tvgCanvasImpl.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/tvgCanvasImpl.h b/src/lib/tvgCanvasImpl.h index d8d713ca..91eb88b9 100644 --- a/src/lib/tvgCanvasImpl.h +++ b/src/lib/tvgCanvasImpl.h @@ -114,10 +114,12 @@ struct Canvas::Impl { if (drawing || paints.count == 0 || !renderer || !renderer->preRender()) return Result::InsufficientCondition; + bool rendered = false; for (auto paint = paints.data; paint < (paints.data + paints.count); ++paint) { - if (!(*paint)->pImpl->render(*renderer)) return Result::InsufficientCondition; + if ((*paint)->pImpl->render(*renderer)) rendered = true; } + if (!rendered) return Result::InsufficientCondition; if (!renderer->postRender()) return Result::InsufficientCondition; drawing = true;