summaryrefslogtreecommitdiff
path: root/render/pixmap.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2004-11-11 03:17:34 +0100
committerTor Andersson <tor@ghostscript.com>2004-11-11 03:17:34 +0100
commit2ec725624d637789845478a90f799e9eeb54f9ee (patch)
treef305158bcd8331a2a656df7221a3acd01cd2724a /render/pixmap.c
parent69478b2d6028a295a32cf9b3c6e632263ef9b31b (diff)
downloadmupdf-2ec725624d637789845478a90f799e9eeb54f9ee.tar.xz
various fixes
Diffstat (limited to 'render/pixmap.c')
-rw-r--r--render/pixmap.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/render/pixmap.c b/render/pixmap.c
index ed64769f..a9287ea8 100644
--- a/render/pixmap.c
+++ b/render/pixmap.c
@@ -21,8 +21,6 @@ fz_newpixmap(fz_pixmap **pixp, int x, int y, int w, int h, int n)
return fz_outofmem;
}
- memset(pix->samples, 0, pix->w * pix->h * pix->n * sizeof(fz_sample));
-
return nil;
}
@@ -195,6 +193,20 @@ fz_debugpixmap(fz_pixmap *pix)
fclose(pgm);
}
+ else if (pix->n == 2)
+ {
+ int x, y;
+ FILE *pgm = fopen("out.pgm", "w");
+ fprintf(pgm, "P5\n%d %d\n255\n", pix->w, pix->h);
+
+ for (y = 0; y < pix->h; y++)
+ for (x = 0; x < pix->w; x++)
+ {
+ putc(pix->samples[y * pix->w * 2 + x * 2 + 1], pgm);
+ }
+ fclose(pgm);
+ }
+
else if (pix->n == 1)
{
FILE *pgm = fopen("out.pgm", "w");