Improve DrawNode::drawPie() (#2222)

This commit is contained in:
aismann 2024-10-28 14:43:09 +01:00 committed by GitHub
parent c993da1b30
commit 53ec946592
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 5 deletions

View File

@ -992,7 +992,7 @@ void DrawNode::_drawPolygon(const Vec2* verts,
extrude[i] = {offset, n2};
}
for (unsigned int i = 0; i < count-1; i++)
for (unsigned int i = 0; i < count; i++)
{
int j = (i + 1) % count;
Vec2 v0 = _vertices[i];
@ -1461,18 +1461,21 @@ void DrawNode::_drawPie(const Vec2& center,
case DrawMode::Fill:
_vertices[n++] = center;
_vertices[n++] = _vertices[0];
_drawPolygon(_vertices.data(), n, fillColor, borderColor, true, thickness, false);
_drawPolygon(_vertices.data(), n, fillColor, Color4B::TRANSPARENT, true, 0, false);
_drawPoly(_vertices.data(), n, false, borderColor, thickness, true);
break;
case DrawMode::Outline:
_vertices[n++] = center;
_vertices[n++] = _vertices[0];
_drawPolygon(_vertices.data(), n, Color4B::TRANSPARENT, borderColor, false, thickness, false);
_drawPoly(_vertices.data(), n, false, borderColor, thickness, true);
break;
case DrawMode::Line:
_drawPolygon(_vertices.data(), n - 1, Color4B::TRANSPARENT, borderColor, false, thickness, false);
_drawPoly(_vertices.data(), n, false, borderColor, thickness, true);
break;
case DrawMode::Semi:
_drawPolygon(_vertices.data(), n - 1, fillColor, borderColor, true, thickness, false);
if (fillColor != Color4B::TRANSPARENT)
_drawPolygon(_vertices.data(), n, fillColor, borderColor, true, 0, false);
_drawPoly(_vertices.data(), n, true, borderColor, thickness, true);
break;
default:
break;