1
0
Fork 0

Canvas: Support for pseudo non-zero fillrule

This commit is contained in:
Thomas Geymayer 2012-09-21 22:03:44 +02:00
parent 4a94071ed7
commit 0f850312ea
2 changed files with 15 additions and 3 deletions

View file

@ -332,8 +332,20 @@ VG_API_CALL void vgDrawPath(VGPath path, VGbitfield paintModes)
/* Tesselate into stencil */
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS, 0, 0);
glStencilOp(GL_INVERT, GL_INVERT, GL_INVERT);
if( context->fillRule == VG_EVEN_ODD )
{
glStencilFunc(GL_ALWAYS, 0, 0);
glStencilOp(GL_INVERT, GL_INVERT, GL_INVERT);
}
else
{
// pseudo non-zero fill rule. Fill everything at least covered once, don't
// care for possible decrements.
// TODO implement real non-zero fill-rule
glStencilFunc(GL_ALWAYS, 1, 1);
glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
}
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
shDrawVertices(p, GL_TRIANGLE_FAN);

View file

@ -210,7 +210,7 @@ namespace canvas
{
vgSetPaint(_paint_fill, VG_FILL_PATH);
vgSetf(VG_FILL_RULE, VG_NON_ZERO); // TODO make user configurable
vgSeti(VG_FILL_RULE, VG_NON_ZERO); // TODO make user configurable
}
// And finally draw the path