From 28a1ee7561ae92dd38023be94076e684eb7e9e59 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Fri, 27 May 2016 19:14:07 +0100 Subject: Tweak plotter code slightly for speed. Use do {} while(--w) rather than while(w--) {} as this safes a test each time around the loop. --- source/fitz/pixmap.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'source/fitz/pixmap.c') diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c index e2564c98..0016c003 100644 --- a/source/fitz/pixmap.c +++ b/source/fitz/pixmap.c @@ -705,19 +705,15 @@ fz_alpha_from_gray(fz_context *ctx, fz_pixmap *gray, int luminosity) alpha = fz_new_pixmap_with_bbox(ctx, NULL, fz_pixmap_bbox(ctx, gray, &bbox), 1); dp = alpha->samples; - dstride = alpha->stride - alpha->w; + dstride = alpha->stride; sp = gray->samples; - sstride = gray->stride - gray->w; + sstride = gray->stride; h = gray->h; + w = gray->w; while (h--) { - w = gray->w; - while (w--) - { - *dp++ = sp[0]; - sp++; - } + memcpy(dp, sp, w); sp += sstride; dp += dstride; } -- cgit v1.2.3