sw_engine: fix a regression bug. 02/237502/1
authorHermet Park <chuneon.park@samsung.com>
Wed, 1 Jul 2020 03:53:01 +0000 (12:53 +0900)
committerHermet Park <chuneon.park@samsung.com>
Wed, 1 Jul 2020 03:53:01 +0000 (12:53 +0900)
Shape must have closed path for filling color.
if closed is skipped, it would take it's a line.

Change-Id: Ie1dcde9edbfc6501a34d6cb9ce54184ade6864db

src/lib/sw_engine/tvgSwShape.cpp
test/testPath.cpp
test/testSceneTransform.cpp

index a4c811a..4c99fb1 100644 (file)
@@ -528,11 +528,14 @@ bool shapeGenOutline(SwShape& shape, const Shape* sdata)
     _growOutlinePoint(*outline, outlinePtsCnt);
     _growOutlineContour(*outline, outlineCntrsCnt);
 
+    auto closed = false;
+
     //Generate Outlines
     while (cmdCnt-- > 0) {
         switch(*cmds) {
             case PathCommand::Close: {
                 _outlineClose(*outline);
+                closed = true;
                 break;
             }
             case PathCommand::MoveTo: {
@@ -556,6 +559,8 @@ bool shapeGenOutline(SwShape& shape, const Shape* sdata)
 
     _outlineEnd(*outline);
 
+    if (closed) outline->opened = false;
+
     //FIXME:
     //outline->flags = SwOutline::FillRule::Winding;
 
index 3fbb834..8c79848 100644 (file)
@@ -39,6 +39,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
     shape2->cubicTo(cx + radius, cy + halfRadius, cx + halfRadius, cy + radius, cx, cy+ radius);
     shape2->cubicTo(cx - halfRadius, cy + radius, cx - radius, cy + halfRadius, cx - radius, cy);
     shape2->cubicTo(cx - radius, cy - halfRadius, cx - halfRadius, cy - radius, cx, cy - radius);
+    shape2->close();
     shape2->fill(255, 0, 0, 255);
     if (canvas->push(move(shape2)) != tvg::Result::Success) return;
 
@@ -147,4 +148,4 @@ int main(int argc, char **argv)
 
     //Terminate ThorVG Engine
     tvg::Initializer::term(tvgEngine);
-}
\ No newline at end of file
+}
index 8c0898f..fc088a5 100644 (file)
@@ -75,6 +75,7 @@ void tvgDrawCmds(tvg::Canvas* canvas)
     shape5->cubicTo(cx + radius, cy + halfRadius, cx + halfRadius, cy + radius, cx, cy+ radius);
     shape5->cubicTo(cx - halfRadius, cy + radius, cx - radius, cy + halfRadius, cx - radius, cy);
     shape5->cubicTo(cx - radius, cy - halfRadius, cx - halfRadius, cy - radius, cx, cy - radius);
+    shape5->close();
     shape5->fill(127, 0, 0, 127);
     scene2->push(move(shape5));
 
@@ -228,4 +229,4 @@ int main(int argc, char **argv)
 
     //Terminate ThorVG Engine
     tvg::Initializer::term(tvgEngine);
-}
\ No newline at end of file
+}