summaryrefslogtreecommitdiff
path: root/source/fitz/draw-paint.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2017-08-02 12:11:03 +0100
committerRobin Watts <robin.watts@artifex.com>2017-10-24 15:16:35 +0100
commit5ca92b5a7166cb0304f9d30d0989b5379c7fa532 (patch)
tree13e8cd576815154304b34ed51f30f15bc4c02ab6 /source/fitz/draw-paint.c
parent874cd7a3b8b803702f1d6ccb8c674e8662002e9b (diff)
downloadmupdf-5ca92b5a7166cb0304f9d30d0989b5379c7fa532.tar.xz
Fix overprint with shadings.
Diffstat (limited to 'source/fitz/draw-paint.c')
-rw-r--r--source/fitz/draw-paint.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/source/fitz/draw-paint.c b/source/fitz/draw-paint.c
index 3eb1c174..581c2ff9 100644
--- a/source/fitz/draw-paint.c
+++ b/source/fitz/draw-paint.c
@@ -2257,6 +2257,54 @@ fz_paint_pixmap(fz_pixmap * restrict dst, const fz_pixmap * restrict src, int al
}
void
+fz_paint_pixmap_with_overprint(fz_pixmap * restrict dst, const fz_pixmap * restrict src, const fz_overprint *op)
+{
+ const unsigned char *sp;
+ unsigned char *dp;
+ fz_irect bbox;
+ fz_irect bbox2;
+ int x, y, w, h, n, da, sa;
+ fz_span_painter_t *fn;
+
+ if (dst->n - dst->alpha != src->n - src->alpha)
+ {
+ fprintf(stderr, "fz_paint_pixmap_with_overprint - FIXME\n");
+ return;
+ }
+ assert(dst->n - dst->alpha == src->n - src->alpha);
+
+ fz_pixmap_bbox_no_ctx(dst, &bbox);
+ fz_pixmap_bbox_no_ctx(src, &bbox2);
+ fz_intersect_irect(&bbox, &bbox2);
+
+ x = bbox.x0;
+ y = bbox.y0;
+ w = bbox.x1 - bbox.x0;
+ h = bbox.y1 - bbox.y0;
+ if (w == 0 || h == 0)
+ return;
+
+ n = src->n;
+ sp = src->samples + (unsigned int)((y - src->y) * src->stride + (x - src->x) * src->n);
+ sa = src->alpha;
+ dp = dst->samples + (unsigned int)((y - dst->y) * dst->stride + (x - dst->x) * dst->n);
+ da = dst->alpha;
+
+ n -= sa;
+ fn = fz_get_span_painter(da, sa, n, 255, op);
+ assert(fn);
+ if (fn == NULL)
+ return;
+
+ while (h--)
+ {
+ (*fn)(dp, da, sp, sa, n, w, 255, op);
+ sp += src->stride;
+ dp += dst->stride;
+ }
+}
+
+void
fz_paint_pixmap_with_mask(fz_pixmap * restrict dst, const fz_pixmap * restrict src, const fz_pixmap * restrict msk)
{
const unsigned char *sp, *mp;