common: enhance clipping behavior. 98/289898/1
authorHermet Park <hermetpark@gmail.com>
Sat, 28 Jan 2023 02:36:54 +0000 (11:36 +0900)
committerMichal Szczecinski <m.szczecinsk@partner.samsung.com>
Wed, 15 Mar 2023 07:28:22 +0000 (08:28 +0100)
If a paint is used as a clipper, it must be determined in the paint behavior.
Propagate its decision to the immediate derived classes so that
not only shapes but also scenes must be dealt as a clipper properly.

This revised this change 0de3872be33793d2c8db03d5b85da38670410626
for better a solution.

Change-Id: I5525cc3ce952b74eec2a52f3bdc769f5ed600f58

src/lib/sw_engine/tvgSwRenderer.cpp

index 48787a308473d5ac5767e915c30d91d01c9dc788..93d0d5ddef528a54dbbe4167bef49e9c4ed57400 100644 (file)
@@ -77,10 +77,8 @@ struct SwShapeTask : SwTask
     bool clipper = false;
 
     void run(unsigned tid) override
-    {
-        auto compMethod = CompositeMethod::None;
-        auto usedAsClip = (sdata->composite(nullptr, &compMethod) == Result::Success) && (compMethod == CompositeMethod::ClipPath);
-        if (opacity == 0 && !usedAsClip) return;  //Invisible
+    {    
+        if (opacity == 0 && !clipper) return;  //Invisible
 
         uint8_t strokeAlpha = 0;
         auto visibleStroke = false;
@@ -102,7 +100,7 @@ struct SwShapeTask : SwTask
             sdata->fillColor(nullptr, nullptr, nullptr, &alpha);
             alpha = static_cast<uint8_t>(static_cast<uint32_t>(alpha) * opacity / 255);
             visibleFill = (alpha > 0 || sdata->fill());
-            if (visibleFill || visibleStroke || usedAsClip) {
+            if (visibleFill || visibleStroke || clipper) {
                 shapeReset(&shape);
                 if (!shapePrepare(&shape, sdata, transform, clipRegion, bbox, mpool, tid, clips.count > 0 ? true : false)) goto err;
             }
@@ -114,7 +112,7 @@ struct SwShapeTask : SwTask
 
         //Fill
         if (flags & (RenderUpdateFlag::Gradient | RenderUpdateFlag::Transform | RenderUpdateFlag::Color)) {
-            if (visibleFill || usedAsClip) {
+            if (visibleFill || clipper) {
                 /* We assume that if stroke width is bigger than 2,
                    shape outline below stroke could be full covered by stroke drawing.
                    Thus it turns off antialising in that condition.