From b58c20b8812c3bbf16286a521e5d841d8a0f488d Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Tue, 17 Jan 2023 13:11:43 +0100 Subject: [PATCH] svg_loader: overwrite the clip's opacity/alpha According to the svg standard the clips opacity doesn't affect the final rendering. In order to avoid any confusion the opacity values are overwritten by the max possible value. --- src/loaders/svg/tvgSvgSceneBuilder.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/loaders/svg/tvgSvgSceneBuilder.cpp b/src/loaders/svg/tvgSvgSceneBuilder.cpp index 6894fa4a..f60c0f64 100644 --- a/src/loaders/svg/tvgSvgSceneBuilder.cpp +++ b/src/loaders/svg/tvgSvgSceneBuilder.cpp @@ -255,7 +255,6 @@ static void _applyComposition(Paint* paint, const SvgNode* node, const Box& vBox node->style->clipPath.applying = true; auto comp = Shape::gen(); - comp->fill(255, 255, 255, 255); if (node->transform) comp->transform(*node->transform); auto child = compNode->child.data; @@ -265,8 +264,11 @@ static void _applyComposition(Paint* paint, const SvgNode* node, const Box& vBox if (_appendChildShape(*child, comp.get(), vBox, svgPath)) valid = true; } - if (valid) paint->composite(move(comp), CompositeMethod::ClipPath); - + if (valid) { + comp->fill(255, 255, 255, 255); + comp->opacity(255); + paint->composite(move(comp), CompositeMethod::ClipPath); + } node->style->clipPath.applying = false; } }