From 69db6d1dc9d68821965afaf42f11a5674fbfc275 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 24 May 2016 15:34:28 +0100 Subject: Fix optimisation in fz_paint_affine_N_near Only do int to int copying if we have an int to copy from. Also, when copying int to int, copy int32_t to int32_t to make us more future proof. --- source/fitz/draw-affine.c | 12 ++++++------ source/fitz/draw-paint.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/fitz/draw-affine.c b/source/fitz/draw-affine.c index 71a0cecd..0d768013 100644 --- a/source/fitz/draw-affine.c +++ b/source/fitz/draw-affine.c @@ -374,9 +374,9 @@ fz_paint_affine_N_near(byte * restrict dp, int da, const byte * restrict sp, int int t = 255 - a; if (t == 0) { - if (n1+da == 4) + if (n1+da == 4 && n1+sa == 4) { - *(int *)dp = *(int *)sample; + *(int32_t *)dp = *(int32_t *)sample; } else { @@ -424,9 +424,9 @@ fz_paint_affine_N_near(byte * restrict dp, int da, const byte * restrict sp, int int t = 255 - a; if (t == 0) { - if (n1+da == 4) + if (n1+da == 4 && n1+sa == 4) { - *(int *)dp = *(int *)sample; + *(int32_t *)dp = *(int32_t *)sample; } else { @@ -471,9 +471,9 @@ fz_paint_affine_N_near(byte * restrict dp, int da, const byte * restrict sp, int int t = 255 - a; if (t == 0) { - if (n1+da == 4) + if (n1+da == 4 && n1+sa == 4) { - *(int *)dp = *(int *)sample; + *(int32_t *)dp = *(int32_t *)sample; } else { diff --git a/source/fitz/draw-paint.c b/source/fitz/draw-paint.c index 568151cc..bd6bdbc1 100644 --- a/source/fitz/draw-paint.c +++ b/source/fitz/draw-paint.c @@ -617,7 +617,7 @@ fz_paint_span_with_mask_3(byte * restrict dp, int da, const byte * restrict sp, { if (da && sa) { - *(int*)dp = *(int *)sp; + *(int32_t *)dp = *(int32_t *)sp; sp += 4; dp += 4; } else @@ -1073,7 +1073,7 @@ fz_paint_span_3(byte * restrict dp, int da, const byte * restrict sp, int sa, in if (t == 0) { if (da && sa) - *(int *)dp = *(const int *)sp; + *(int32_t *)dp = *(const int32_t *)sp; else { dp[0] = sp[0]; -- cgit v1.2.3