cogl-path: Don't bother filling the path if less than 3 nodes

Previously there was a check to avoid filling the path if there are
zero nodes. However the tesselator also won't generate any triangles
if there are less than 3 nodes so we might as well bail out in that
case too. If we don't emit any triangles then we would end up trying
to create an empty VBO. Although I don't think this should necessarily
be a problem, this seems to cause Mesa to segfault in version 7.8.1
when calling glBufferSubData (although not in
master). test-cogl-primitives tries to fill a path with only two
points so it's convenient to be able to avoid the crash in this case.
This commit is contained in:
Neil Roberts 2010-11-03 16:02:27 +00:00
parent 3c8c195115
commit a25aad954e

View File

@ -421,7 +421,7 @@ _cogl_add_path_to_stencil_buffer (CoglPath *path,
GE (glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT)); GE (glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT));
if (path->data->path_nodes->len > 0) if (path->data->path_nodes->len >= 3)
_cogl_path_fill_nodes (path); _cogl_path_fill_nodes (path);
if (merge) if (merge)
@ -479,7 +479,7 @@ cogl_path_fill_preserve (void)
path = COGL_PATH (ctx->current_path); path = COGL_PATH (ctx->current_path);
if (path->data->path_nodes->len == 0) if (path->data->path_nodes->len < 3)
return; return;
_cogl_journal_flush (); _cogl_journal_flush ();