From 6a87014ff020538841d7f5a0dd1adef8a6ce9e79 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 4 Apr 2011 17:44:27 +0200 Subject: Add device interface functions to draw tiled patterns. --- draw/porterduff.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'draw') diff --git a/draw/porterduff.c b/draw/porterduff.c index b8130ab6..69df467a 100644 --- a/draw/porterduff.c +++ b/draw/porterduff.c @@ -346,6 +346,36 @@ fz_paintspan(byte * restrict dp, byte * restrict sp, int n, int w, int alpha) * Pixmap blending functions */ +void +fz_paintpixmapbbox(fz_pixmap *dst, fz_pixmap *src, int alpha, fz_bbox bbox) +{ + unsigned char *sp, *dp; + int x, y, w, h, n; + + assert(dst->n == src->n); + + bbox = fz_intersectbbox(bbox, fz_boundpixmap(dst)); + bbox = fz_intersectbbox(bbox, fz_boundpixmap(src)); + + x = bbox.x0; + y = bbox.y0; + w = bbox.x1 - bbox.x0; + h = bbox.y1 - bbox.y0; + if ((w | h) == 0) + return; + + n = src->n; + sp = src->samples + ((y - src->y) * src->w + (x - src->x)) * src->n; + dp = dst->samples + ((y - dst->y) * dst->w + (x - dst->x)) * dst->n; + + while (h--) + { + fz_paintspan(dp, sp, n, w, alpha); + sp += src->w * n; + dp += dst->w * n; + } +} + void fz_paintpixmap(fz_pixmap *dst, fz_pixmap *src, int alpha) { -- cgit v1.2.3