[GRASS-SVN] r32867 - grass/trunk/lib/pngdriver

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 18 16:38:02 EDT 2008


Author: glynn
Date: 2008-08-18 16:38:02 -0400 (Mon, 18 Aug 2008)
New Revision: 32867

Modified:
   grass/trunk/lib/pngdriver/Polygon.c
Log:
Fix bugs in polygon filler


Modified: grass/trunk/lib/pngdriver/Polygon.c
===================================================================
--- grass/trunk/lib/pngdriver/Polygon.c	2008-08-18 20:24:15 UTC (rev 32866)
+++ grass/trunk/lib/pngdriver/Polygon.c	2008-08-18 20:38:02 UTC (rev 32867)
@@ -26,10 +26,10 @@
     int yi = (int) floor(y);
     int xi0 = (int) floor(x0 + 0.5);
     int xi1 = (int) floor(x1 + 0.5);
-    unsigned int *p = &grid[yi * width + xi1];
+    unsigned int *p;
     int x;
 
-    if (yi < clip_bot || yi >= clip_top)
+    if (yi >= clip_bot || yi < clip_top)
 	return;
 
     if (xi0 > clip_rite)
@@ -44,7 +44,7 @@
     if (xi1 > clip_rite)
 	xi1 = clip_rite;
 
-    p = &grid[yi * width + xi1];
+    p = &grid[yi * width + xi0];
 
     for (x = xi0; x < xi1; x++)
 	*p++ = currentColor;
@@ -53,7 +53,7 @@
 static void line(const struct point *p, int n, double y)
 {
     static double *xs;
-    static double max_x;
+    static int max_x;
     int num_x = 0;
     int i;
 
@@ -119,6 +119,8 @@
     if (y1 > clip_bot)
 	y1 = clip_bot;
 
+    y0 = floor(y0 + 0.5) + 0.5;
+
     for (y = y0; y < y1; y++)
 	line(p, n, y + 0.5);
 }



More information about the grass-commit mailing list