From a25aad954e4a7bef577fea0cd9b88439b536f096 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 3 Nov 2010 16:02:27 +0000 Subject: [PATCH] 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. --- cogl/cogl-path.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cogl/cogl-path.c b/cogl/cogl-path.c index 0c8b1f349..9e4eee71a 100644 --- a/cogl/cogl-path.c +++ b/cogl/cogl-path.c @@ -421,7 +421,7 @@ _cogl_add_path_to_stencil_buffer (CoglPath *path, 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); if (merge) @@ -479,7 +479,7 @@ cogl_path_fill_preserve (void) path = COGL_PATH (ctx->current_path); - if (path->data->path_nodes->len == 0) + if (path->data->path_nodes->len < 3) return; _cogl_journal_flush ();