summaryrefslogtreecommitdiff
path: root/draw
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-08-07 13:17:31 +0000
committerTor Andersson <tor@ghostscript.com>2010-08-07 13:17:31 +0000
commit1f2595c8c65b543f0c7a071fa30ec72ad7a67d2f (patch)
tree79b6f803904fac74a45e28992baceae823c09dcb /draw
parent17dbea62bfa74f0c64cda9a887bc1625988571f4 (diff)
downloadmupdf-1f2595c8c65b543f0c7a071fa30ec72ad7a67d2f.tar.xz
Fix bug where image with alpha painting was not multiplying colors with the constant alpha.
Diffstat (limited to 'draw')
-rw-r--r--draw/imagedraw.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/draw/imagedraw.c b/draw/imagedraw.c
index b9bb2702..d1977cea 100644
--- a/draw/imagedraw.c
+++ b/draw/imagedraw.c
@@ -57,13 +57,13 @@ fz_paintaffinealphaN(byte *dp, byte *sp, int sw, int sh, int u, int v, int fa, i
for (k = 0; k < n; k++)
{
x = bilerp(a[k], b[k], c[k], d[k], uf, vf);
- dp[k] = x + fz_mul255(dp[k], t);
+ dp[k] = fz_mul255(x, alpha) + fz_mul255(dp[k], t);
}
#else
byte *sample = sp + ((vi * sw + ui) * n);
int t = 255 - fz_mul255(sample[n-1], alpha);
for (k = 0; k < n; k++)
- dp[k] = sample[k] + fz_mul255(dp[k], t);
+ dp[k] = fz_mul255(sample[k], alpha) + fz_mul255(dp[k], t);
#endif
}
dp += n;
@@ -160,7 +160,7 @@ fz_paintaffine(byte *dp, byte *sp, int sw, int sh, int u, int v, int fa, int fb,
default: fz_paintaffineN(dp, sp, sw, sh, u, v, fa, fb, w, n); break;
}
}
- else if (alpha > 0)
+ else if (alpha > 0)
{
switch (n)
{