summaryrefslogtreecommitdiff
path: root/render/rendertext.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2004-10-26 10:24:06 +0200
committerTor Andersson <tor@ghostscript.com>2004-10-26 10:24:06 +0200
commit49a070da0310ee57cb332e80275f19155bc2c479 (patch)
tree7826c0c2a1b62917cc0fcd1e47f43d11d99c7105 /render/rendertext.c
parent531800e0723dee005d4912cdc6ca12466ca8f18a (diff)
downloadmupdf-49a070da0310ee57cb332e80275f19155bc2c479.tar.xz
clean up pixmap and image code
Diffstat (limited to 'render/rendertext.c')
-rw-r--r--render/rendertext.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/render/rendertext.c b/render/rendertext.c
index 81afeafa..1a3c49db 100644
--- a/render/rendertext.c
+++ b/render/rendertext.c
@@ -17,9 +17,9 @@ static void blitalphaglyph(fz_pixmap *out, fz_glyph *gl, int xo, int yo)
if (dy >= out->h) continue;
a = gl->bitmap[sx + sy * gl->w];
- b = out->samples[dx + dy * out->stride];
- c = MAX(a, b);
- out->samples[dx + dy * out->stride] = c;
+ b = out->samples[dx + dy * out->w];
+ c = a + fz_mul255(b, 255 - a);
+ out->samples[dx + dy * out->w] = c;
}
}
}
@@ -44,11 +44,11 @@ static void blitcolorglyph(fz_pixmap *out, fz_glyph *gl, int xo, int yo, fz_rend
sa = gl->bitmap[sx + sy * gl->w];
ssa = 255 - sa;
- p = out->samples + dx * 4 + dy * out->stride;
- p[0] = fz_mul255(gc->r, sa) + fz_mul255(p[0], ssa);
- p[1] = fz_mul255(gc->g, sa) + fz_mul255(p[1], ssa);
- p[2] = fz_mul255(gc->b, sa) + fz_mul255(p[2], ssa);
- p[3] = sa + fz_mul255(ssa, p[3]);
+ p = out->samples + dx * 4 + dy * out->w * out->n;
+ p[0] = sa + fz_mul255(ssa, p[0]);
+ p[1] = fz_mul255(gc->r, sa) + fz_mul255(p[1], ssa);
+ p[2] = fz_mul255(gc->g, sa) + fz_mul255(p[2], ssa);
+ p[3] = fz_mul255(gc->b, sa) + fz_mul255(p[3], ssa);
}
}
}
@@ -62,7 +62,7 @@ fz_rendertext(fz_renderer *gc, fz_textnode *text, fz_matrix ctm)
int g, i, ix, iy;
fz_matrix tm, trm;
- 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;