diff options
author | scuri <scuri> | 2010-09-28 17:32:52 +0000 |
---|---|---|
committer | scuri <scuri> | 2010-09-28 17:32:52 +0000 |
commit | 88254b03ccd351d5acc4ba582f0e9c092a60f433 (patch) | |
tree | 92d5b7b1cf84290f6acb79f910ce8518c630cfe7 /src/sim/sim_linepolyfill.c | |
parent | 1cae99934c168b5cc8cae4c26bc4ffe4b995206a (diff) |
Fixed: polygon filling in CD_IMAGERGB driver when there are many horizontal lines in sequence on the same polygon.
Diffstat (limited to 'src/sim/sim_linepolyfill.c')
-rw-r--r-- | src/sim/sim_linepolyfill.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/sim/sim_linepolyfill.c b/src/sim/sim_linepolyfill.c index 745c70b..93758be 100644 --- a/src/sim/sim_linepolyfill.c +++ b/src/sim/sim_linepolyfill.c @@ -390,6 +390,8 @@ static void simAddHxx(int *hh, int *hh_count, int x1, int x2) int i, count = *hh_count; + assert(count%2==0); + if (x1 > x2) { int t = x2; @@ -423,6 +425,8 @@ static void simMergeHxx(int *xx, int *xx_count, int *hh, int hh_count) { int hh_i; + assert(hh_count%2==0); + if (*xx_count == 0) { memcpy(xx, hh, hh_count*sizeof(int)); @@ -444,7 +448,7 @@ int simPolyFindHorizontalIntervals(simLineSegment *segments, int n_seg, int* xx, simLineSegment *seg_i; int i, hh_count = 0; int xx_count = 0; /* count the number of points in the horizontal line, - each pair will form an horizontal interval */ + each pair will form an horizontal interval */ /* for all segments, calculates the intervals to be filled from the intersection with the horizontal line y. */ @@ -481,10 +485,16 @@ int simPolyFindHorizontalIntervals(simLineSegment *segments, int n_seg, int* xx, simAddHxx(hh, &hh_count, seg_i_next->x1, seg_i_next->x2); i++; - i_next = (i==n_seg-1)? 0: i+1; - seg_i_next = segments + i_next; + if (i < n_seg) + { + i_next = (i==n_seg-1)? 0: i+1; + seg_i_next = segments + i_next; + } } + if (i == n_seg) + break; + /* save the next y, not in the horizontal line */ if (seg_i_next->y1 == y) next_y = seg_i_next->y2; |