From 98f5b6a0c92b7160cc7c0f21ca0a4c85369ab031 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Wed, 30 Apr 2008 21:48:47 +0000 Subject: [PATCH] * clutter/cogl/gles/cogl-primitives.c: (_cogl_path_fill_nodes): keep track of direction we are drawing in and make sure we leave two intersection points when we have changed direction. --- ChangeLog | 6 ++++++ clutter/cogl/gles/cogl-primitives.c | 22 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 39774c6..264f499 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ 2008-04-30 Øyvind Kolås * clutter/cogl/gles/cogl-primitives.c: (_cogl_path_fill_nodes): + keep track of direction we are drawing in and make sure we leave + two intersection points when we have changed direction. + +2008-04-30 Øyvind Kolås + + * clutter/cogl/gles/cogl-primitives.c: (_cogl_path_fill_nodes): scanline rasterizer fallback for GLES without working stencil buffer (would benefit from optimization/smarter choice of datastructures). diff --git a/clutter/cogl/gles/cogl-primitives.c b/clutter/cogl/gles/cogl-primitives.c index df0eeba..1a9e99a 100644 --- a/clutter/cogl/gles/cogl-primitives.c +++ b/clutter/cogl/gles/cogl-primitives.c @@ -254,6 +254,8 @@ _cogl_path_fill_nodes () gint prev_y; gint first_x; gint first_y; + gint lastdir=-2; /* last direction we vere moving */ + gint lastline=-1; /* the previous scanline we added to */ /* clear scanline intersection lists */ for (i=0; i < bounds_h; i++) @@ -278,14 +280,21 @@ fill_close: if (dy < 0) ydir = -1; - else + else if (dy > 0) ydir = 1; + else + ydir = 0; /* do linear interpolation between vertexes */ for (y=prev_y; y!= dest_y; y += ydir) { + + /* only add a point if the scanline has changed and we're + * within bounds. + */ if (y-bounds_y >= 0 && - y-bounds_y < bounds_h) + y-bounds_y < bounds_h && + lastline != y) { gint x = prev_x + (dx * (y-prev_y)) / dy; @@ -293,6 +302,15 @@ fill_close: g_slist_insert_sorted (scanlines[ y - bounds_y], GINT_TO_POINTER(x), compare_ints); + + if (ydir != lastdir && /* add a double entry when changing */ + lastdir!=-2) /* vertical direction */ + scanlines[ y - bounds_y ]= + g_slist_insert_sorted (scanlines[ y - bounds_y], + GINT_TO_POINTER(x), + compare_ints); + lastdir = ydir; + lastline = y; } } -- 2.7.4