From 482dd0e6f889a4c08d97f742b89a272ba24389ee Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Fri, 13 Jun 2025 23:49:34 +0900 Subject: [PATCH] renderer: precise condition check for skip compositions single child picture would not also requre composition in a scene --- src/renderer/tvgScene.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/renderer/tvgScene.h b/src/renderer/tvgScene.h index ed6f8cde..16e7f1a2 100644 --- a/src/renderer/tvgScene.h +++ b/src/renderer/tvgScene.h @@ -94,10 +94,11 @@ struct SceneImpl : Scene //Half translucent requires intermediate composition. if (opacity == 255) return compFlag; - //If scene has several children or only scene, it may require composition. - //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.size() == 1 && paints.front()->type() == Type::Shape) return compFlag; + //Only shape or picture may not require composition. + if (paints.size() == 1) { + auto type = paints.front()->type(); + if (type == Type::Shape || type == Type::Picture) return compFlag; + } compFlag |= CompositionFlag::Opacity;