common scene: fix a potential composition bug.

In the current implementation, only a scene with a single shape type
is able to skip the composition step. However, a child picture might
have multiple children shapes as well, which leads to the bug.
This commit is contained in:
Hermet Park 2023-05-16 16:23:34 +09:00 committed by Hermet Park
parent be2de28312
commit c7d77b3517

View file

@ -100,9 +100,11 @@ struct Scene::Impl
if (opacity == 255) return false;
//If scene has several children or only scene, it may require composition.
if (paints.count > 1) return true;
if (paints.count == 1 && (*paints.data)->identifier() == TVG_CLASS_ID_SCENE) return true;
return false;
//OPTIMIZE: the bitmap type of the picture would not need the composition.
//OPTIMIZE: a single paint of a scene would not need the composition.
if (paints.count == 1 && (*paints.data)->identifier() == TVG_CLASS_ID_SHAPE) return false;
return true;
}
RenderData update(RenderMethod &renderer, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag flag, bool clipper)