sw_engine: fix a regression bug.

Shape must have closed path for filling color.
if closed is skipped, it would take it's a line.

Change-Id: Ie1dcde9edbfc6501a34d6cb9ce54184ade6864db
This commit is contained in:
Hermet Park 2020-07-01 12:53:01 +09:00
parent f377f33993
commit 5faa94340f
3 changed files with 9 additions and 2 deletions

View file

@ -528,11 +528,14 @@ bool shapeGenOutline(SwShape& shape, const Shape* sdata)
_growOutlinePoint(*outline, outlinePtsCnt); _growOutlinePoint(*outline, outlinePtsCnt);
_growOutlineContour(*outline, outlineCntrsCnt); _growOutlineContour(*outline, outlineCntrsCnt);
auto closed = false;
//Generate Outlines //Generate Outlines
while (cmdCnt-- > 0) { while (cmdCnt-- > 0) {
switch(*cmds) { switch(*cmds) {
case PathCommand::Close: { case PathCommand::Close: {
_outlineClose(*outline); _outlineClose(*outline);
closed = true;
break; break;
} }
case PathCommand::MoveTo: { case PathCommand::MoveTo: {
@ -556,6 +559,8 @@ bool shapeGenOutline(SwShape& shape, const Shape* sdata)
_outlineEnd(*outline); _outlineEnd(*outline);
if (closed) outline->opened = false;
//FIXME: //FIXME:
//outline->flags = SwOutline::FillRule::Winding; //outline->flags = SwOutline::FillRule::Winding;

View 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 + 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 - halfRadius, cy + radius, cx - radius, cy + halfRadius, cx - radius, cy);
shape2->cubicTo(cx - radius, cy - halfRadius, cx - halfRadius, cy - radius, cx, cy - radius); shape2->cubicTo(cx - radius, cy - halfRadius, cx - halfRadius, cy - radius, cx, cy - radius);
shape2->close();
shape2->fill(255, 0, 0, 255); shape2->fill(255, 0, 0, 255);
if (canvas->push(move(shape2)) != tvg::Result::Success) return; if (canvas->push(move(shape2)) != tvg::Result::Success) return;

View 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 + 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 - halfRadius, cy + radius, cx - radius, cy + halfRadius, cx - radius, cy);
shape5->cubicTo(cx - radius, cy - halfRadius, cx - halfRadius, cy - radius, cx, cy - radius); shape5->cubicTo(cx - radius, cy - halfRadius, cx - halfRadius, cy - radius, cx, cy - radius);
shape5->close();
shape5->fill(127, 0, 0, 127); shape5->fill(127, 0, 0, 127);
scene2->push(move(shape5)); scene2->push(move(shape5));