svg_loader: overwrite the clip's opacity/alpha 08/289808/1
authorMira Grudzinska <veleveta@gmail.com>
Tue, 17 Jan 2023 12:11:43 +0000 (13:11 +0100)
committerMichal Szczecinski <mihashco89@gmail.com>
Tue, 14 Mar 2023 09:47:19 +0000 (10:47 +0100)
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.

Change-Id: Ife206ab742023bd3e4d2f0952f0a51ce2b53e75a

src/loaders/svg/tvgSvgSceneBuilder.cpp

index 6894fa4ace4605a9b8cf29c69cc0f28ed3cb96ff..f60c0f64bb3b48275eb68d6f340dcee9c768cc08 100644 (file)
@@ -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;
         }
     }