summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscuri <scuri>2010-09-28 17:32:52 +0000
committerscuri <scuri>2010-09-28 17:32:52 +0000
commit88254b03ccd351d5acc4ba582f0e9c092a60f433 (patch)
tree92d5b7b1cf84290f6acb79f910ce8518c630cfe7
parent1cae99934c168b5cc8cae4c26bc4ffe4b995206a (diff)
Fixed: polygon filling in CD_IMAGERGB driver when there are many horizontal lines in sequence on the same polygon.
-rw-r--r--html/en/history.html4
-rw-r--r--mak.vc9/cdcore.vcproj4
-rw-r--r--src/sim/sim_linepolyfill.c16
3 files changed, 21 insertions, 3 deletions
diff --git a/html/en/history.html b/html/en/history.html
index 678a7b5..e5f073f 100644
--- a/html/en/history.html
+++ b/html/en/history.html
@@ -46,6 +46,10 @@
<span class="hist_fixed">Fixed:</span> background transparency was not
being considered when backopacity was set to OPAQUE after the background
color was set in the GDI+ base driver.</li>
+ <li>
+ <span class="hist_fixed">Fixed:</span> polygon filling in CD_IMAGERGB
+ driver when there are many horizontal lines in sequence on the same
+ polygon.</li>
</ul>
<h3><a href="http://sourceforge.net/projects/canvasdraw/files/5.4/">Version 5.4</a> (24/June/2010)</h3>
<ul>
diff --git a/mak.vc9/cdcore.vcproj b/mak.vc9/cdcore.vcproj
index 93c3a77..919c9d8 100644
--- a/mak.vc9/cdcore.vcproj
+++ b/mak.vc9/cdcore.vcproj
@@ -469,6 +469,10 @@
>
</File>
<File
+ RelativePath=".\cd.vcproj"
+ >
+ </File>
+ <File
RelativePath="..\src\cd_active.c"
>
<FileConfiguration
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;