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
This commit is contained in:
Michal Maciola 2021-09-28 13:15:24 +02:00 committed by Hermet Park
parent 591ea1d61c
commit 81e6471071

View file

@ -114,10 +114,12 @@ struct Canvas::Impl
{ {
if (drawing || paints.count == 0 || !renderer || !renderer->preRender()) return Result::InsufficientCondition; 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) { 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; if (!renderer->postRender()) return Result::InsufficientCondition;
drawing = true; drawing = true;