diff options
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); |