summaryrefslogtreecommitdiff
path: root/source/fitz/draw-paint.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-10-06 17:45:36 +0100
committerRobin Watts <robin.watts@artifex.com>2016-10-07 16:56:46 +0100
commita9543691208e92c4ff8f7d1ff39d95543b557c60 (patch)
tree190c42e1c43553d6a5a59c2c3a96522c5b54243f /source/fitz/draw-paint.c
parente28172f2caef1b89e4f43cc76bf2d510eeb1dc3e (diff)
downloadmupdf-a9543691208e92c4ff8f7d1ff39d95543b557c60.tar.xz
Tweak painters: If painting 0 alpha, skip it.
Diffstat (limited to 'source/fitz/draw-paint.c')
-rw-r--r--source/fitz/draw-paint.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/fitz/draw-paint.c b/source/fitz/draw-paint.c
index 96bff706..061ee630 100644
--- a/source/fitz/draw-paint.c
+++ b/source/fitz/draw-paint.c
@@ -879,6 +879,12 @@ template_span_with_mask_1_general(byte * restrict dp, int da, const byte * restr
{
if (sa)
{
+ if (sp[1] == 0)
+ {
+ sp += 2;
+ dp += 1+da;
+ continue;
+ }
masa = FZ_COMBINE(sp[1], ma);
masa = 255 - masa;
masa = FZ_EXPAND(masa);
@@ -964,6 +970,12 @@ template_span_with_mask_3_general(byte * restrict dp, int da, const byte * restr
/* FIXME: There is potential for SWAR optimisation here */
if (sa)
{
+ if (sp[3] == 0)
+ {
+ sp += 4;
+ dp += 3+da;
+ continue;
+ }
masa = FZ_COMBINE(sp[3], ma);
masa = 255 - masa;
masa = FZ_EXPAND(masa);
@@ -1051,6 +1063,12 @@ template_span_with_mask_4_general(byte * restrict dp, int da, const byte * restr
{
if (sa)
{
+ if (sp[4] == 0)
+ {
+ sp += 5;
+ dp += 4+da;
+ continue;
+ }
masa = FZ_COMBINE(sp[4], ma);
masa = 255 - masa;
masa = FZ_EXPAND(masa);
@@ -1140,6 +1158,12 @@ template_span_with_mask_N_general(byte * restrict dp, int da, const byte * restr
if (sa)
{
int masa;
+ if (sp[n] == 0)
+ {
+ sp += n+1;
+ dp += n+da;
+ continue;
+ }
masa = FZ_COMBINE(sp[n], ma);
masa = 255-masa;
masa = FZ_EXPAND(masa);