diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-01-03 12:07:11 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-01-03 17:36:52 +0000 |
commit | a842269cb43fcb5f1d0bdd594d8d0839a7dcbdf7 (patch) | |
tree | 0ff3885a8421e59cb5eadc3f65123ce01f37b2b5 /draw/draw_blend.c | |
parent | 634fa34f946fb3d48736917102a1e5be583a3fc8 (diff) | |
download | mupdf-a842269cb43fcb5f1d0bdd594d8d0839a7dcbdf7.tar.xz |
Rework draw device stack handling.
As we create clips/transparency groups etc, we maintain a stack of
draw device states.
Here we change this from having a 'current' state, and storing changes
on the stack to always keeping the complete current state on the head
of the stack. This should make error cleanup easier, as well as being
conceptually easier to follow (for me at least).
Diffstat (limited to 'draw/draw_blend.c')
-rw-r--r-- | draw/draw_blend.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/draw/draw_blend.c b/draw/draw_blend.c index a4cdbf19..518d3ab4 100644 --- a/draw/draw_blend.c +++ b/draw/draw_blend.c @@ -140,13 +140,13 @@ fz_luminosity_rgb(int *rd, int *gd, int *bd, int rb, int gb, int bb, int rs, int { int max; max = MAX(r, MAX(g, b)); - scale = ((255 - y) << 16) / (max - y); + scale = (max == y ? 0 : ((255 - y) << 16) / (max - y)); } else { int min; min = MIN(r, MIN(g, b)); - scale = (y << 16) / (y - min); + scale = (y == min ? 0 : (y << 16) / (y - min)); } r = y + (((r - y) * scale + 0x8000) >> 16); g = y + (((g - y) * scale + 0x8000) >> 16); |