=================================================================== RCS file: /home/cvs/OpenXM_contrib/gnuplot/Attic/bitmap.c,v retrieving revision 1.1.1.2 retrieving revision 1.1.1.3 diff -u -p -r1.1.1.2 -r1.1.1.3 --- OpenXM_contrib/gnuplot/Attic/bitmap.c 2000/01/22 14:15:56 1.1.1.2 +++ OpenXM_contrib/gnuplot/Attic/bitmap.c 2003/09/15 07:09:24 1.1.1.3 @@ -1,5 +1,5 @@ #ifndef lint -static char *RCSid = "$Id: bitmap.c,v 1.1.1.2 2000/01/22 14:15:56 maekawa Exp $"; +static char *RCSid = "$Id: bitmap.c,v 1.1.1.3 2003/09/15 07:09:24 ohara Exp $"; #endif /* GNUPLOT - bitmap.c */ @@ -846,8 +846,6 @@ unsigned int x, y, value; } -/* Currently unused */ -#if 1 /* HBB 991008: used by PNG, now */ /* * get pixel (x,y) value */ @@ -857,7 +855,7 @@ unsigned int x, y; { register unsigned int row; register unsigned char mask; - register unsigned char value; + register unsigned char value = 0; int i; if (b_rastermode) { @@ -876,10 +874,10 @@ unsigned int x, y; row -= b_psize; value <<= 1; } - return(value); - } - else - { +/* HBB 991123: the missing '>>1' was the 'every second color' problem + * with PNG in 3.8a...*/ + return(value>>1); + } else { #ifdef BITMAPDEBUG if (b_rastermode) fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n", @@ -890,7 +888,6 @@ unsigned int x, y; return(0); } } -#endif /* 0 */ /* @@ -914,11 +911,11 @@ unsigned int x, y, planes; b_angle = 0; b_rastermode = 0; /* allocate row pointers */ - b_p = (bitmap *) gp_alloc((unsigned long) rows * sizeof(pixels *), "bitmap row buffer"); + b_p = (bitmap *) gp_alloc(rows * sizeof(pixels *), "bitmap row buffer"); memset(b_p, 0, rows * sizeof(pixels *)); for (j = 0; j < rows; j++) { /* allocate bitmap buffers */ - (*b_p)[j] = (pixels *) gp_alloc((unsigned long) x * sizeof(pixels), (char *) NULL); + (*b_p)[j] = (pixels *) gp_alloc(x * sizeof(pixels), (char *) NULL); if ((*b_p)[j] == (pixels *) NULL) { b_freebitmap(); /* free what we have already allocated */ int_error("out of memory for bitmap buffer", NO_CARET);