svg_loader: fixing the used mask-type 72/289072/1
authorMira Grudzinska <m.grudzinska@samsung.com>
Tue, 1 Feb 2022 22:34:41 +0000 (23:34 +0100)
committerMichal Szczecinski <m.szczecinsk@partner.samsung.com>
Tue, 28 Feb 2023 08:34:11 +0000 (09:34 +0100)
For the performance reasons, regardless of the set/default
mask-type value, if the mask is white, the alpha masking is
used. To qualify a mask as white, not only its fill has to be
checked, but its stroke as well. The second was missing.

Change-Id: I407ec17f1b8dfd8fda5948319cf11bd609e7ab91

src/loaders/svg/tvgSvgSceneBuilder.cpp

index e9b8f42..9abcc6a 100644 (file)
@@ -594,7 +594,10 @@ static unique_ptr<Scene> _sceneBuildHelper(const SvgNode* node, const Box& vBox,
                         if (isMaskWhite) {
                             uint8_t r, g, b;
                             shape->fillColor(&r, &g, &b, nullptr);
-                            if (shape->fill() || r < 255 || g < 255 || b < 255) *isMaskWhite = false;
+                            if (shape->fill() || r < 255 || g < 255 || b < 255 || shape->strokeFill() ||
+                                (shape->strokeColor(&r, &g, &b, nullptr) == Result::Success && (r < 255 || g < 255 || b < 255))) {
+                                *isMaskWhite = false;
+                            }
                         }
                         scene->push(move(shape));
                     }