summaryrefslogtreecommitdiff
path: root/draw
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-04-04 17:44:27 +0200
committerTor Andersson <tor.andersson@artifex.com>2011-04-04 17:44:27 +0200
commit6a87014ff020538841d7f5a0dd1adef8a6ce9e79 (patch)
treea98e917471df377a3e2ef852652ebb1535bec0be /draw
parente77893b29cf53a9d6933cab0f9ae9e78b30a6592 (diff)
downloadmupdf-6a87014ff020538841d7f5a0dd1adef8a6ce9e79.tar.xz
Add device interface functions to draw tiled patterns.
Diffstat (limited to 'draw')
-rw-r--r--draw/porterduff.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/draw/porterduff.c b/draw/porterduff.c
index b8130ab6..69df467a 100644
--- a/draw/porterduff.c
+++ b/draw/porterduff.c
@@ -347,6 +347,36 @@ fz_paintspan(byte * restrict dp, byte * restrict sp, int n, int w, int alpha)
*/
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)
{
unsigned char *sp, *dp;