diff options
author | Tor Andersson <tor@ghostscript.com> | 2004-10-26 10:24:06 +0200 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2004-10-26 10:24:06 +0200 |
commit | 49a070da0310ee57cb332e80275f19155bc2c479 (patch) | |
tree | 7826c0c2a1b62917cc0fcd1e47f43d11d99c7105 /render/renderpath.c | |
parent | 531800e0723dee005d4912cdc6ca12466ca8f18a (diff) | |
download | mupdf-49a070da0310ee57cb332e80275f19155bc2c479.tar.xz |
clean up pixmap and image code
Diffstat (limited to 'render/renderpath.c')
-rw-r--r-- | render/renderpath.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/render/renderpath.c b/render/renderpath.c index 8d2f875b..a83505f9 100644 --- a/render/renderpath.c +++ b/render/renderpath.c @@ -1,7 +1,6 @@ #include <fitz.h> // enum { HS = 1, VS = 1, SF = 255 }; -// enum { HS = 5, VS = 3, SF = 17 }; enum { HS = 17, VS = 15, SF = 1 }; static fz_error *pathtogel(fz_gel *gel, fz_pathnode *path, fz_matrix ctm) @@ -9,7 +8,6 @@ static fz_error *pathtogel(fz_gel *gel, fz_pathnode *path, fz_matrix ctm) float flatness = 0.3 / ctm.a; if (flatness < 0.1) flatness = 0.1; - if (path->paint == FZ_STROKE) { if (path->dash) @@ -43,17 +41,17 @@ static void blitcolorspan(int y, int x, int n, unsigned char *alpha, void *userd if (n < 0) return; - p = &pix->samples[(y - pix->y) * pix->stride + (x - pix->x) * 4]; + p = pix->samples + ((y - pix->y) * pix->w + (x - pix->x)) * pix->n; while (n--) { sa = *alpha++ * SF; ssa = 255 - sa; - p[0] = fz_mul255(r, sa) + fz_mul255(p[0], ssa); - p[1] = fz_mul255(g, sa) + fz_mul255(p[1], ssa); - p[2] = fz_mul255(b, sa) + fz_mul255(p[2], ssa); - p[3] = sa + fz_mul255(p[3], ssa); + p[0] = sa + fz_mul255(p[0], ssa); + p[1] = fz_mul255(r, sa) + fz_mul255(p[1], ssa); + p[2] = fz_mul255(g, sa) + fz_mul255(p[2], ssa); + p[3] = fz_mul255(b, sa) + fz_mul255(p[3], ssa); p += 4; } @@ -77,7 +75,7 @@ static void blitalphaspan(int y, int x, int n, unsigned char *alpha, void *userd if (n < 0) return; - p = &pix->samples[(y - pix->y) * pix->stride + (x - pix->x)]; + p = pix->samples + (y - pix->y) * pix->w + (x - pix->x); while (n--) *p++ = *alpha++ * SF; } @@ -122,7 +120,7 @@ fz_renderpath(fz_renderer *gc, fz_pathnode *path, fz_matrix ctm) fz_sortgel(gc->gel); - error = fz_newpixmap(&gc->tmp, nil, gc->x, gc->y, gc->w, gc->h, 0, 1); + error = fz_newpixmap(&gc->tmp, gc->x, gc->y, gc->w, gc->h, 1); if (error) return error; |