mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-25 23:59:12 +00:00
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:
parent
f377f33993
commit
5faa94340f
3 changed files with 9 additions and 2 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue