From 2ec725624d637789845478a90f799e9eeb54f9ee Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 11 Nov 2004 03:17:34 +0100 Subject: various fixes --- render/pixmap.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'render/pixmap.c') 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"); -- cgit v1.2.3