summaryrefslogtreecommitdiff
path: root/source/fitz/pixmap.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-05-27 19:14:07 +0100
committerRobin Watts <robin.watts@artifex.com>2016-05-29 10:11:36 +0100
commit28a1ee7561ae92dd38023be94076e684eb7e9e59 (patch)
tree80ffbc1c407e066cbd8bea196921339662232c6e /source/fitz/pixmap.c
parent388e34e47dcf6132f63877d133d6d7679d1b8537 (diff)
downloadmupdf-28a1ee7561ae92dd38023be94076e684eb7e9e59.tar.xz
Tweak plotter code slightly for speed.
Use do {} while(--w) rather than while(w--) {} as this safes a test each time around the loop.
Diffstat (limited to 'source/fitz/pixmap.c')
-rw-r--r--source/fitz/pixmap.c12
1 files changed, 4 insertions, 8 deletions
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;
}