gaudi: fix exclusion's factor range

Avoid dividing by zero when the factor is zero. Instead, output a buffer with
all color values as zero.
This commit is contained in:
Luis de Bethencourt 2015-04-22 14:30:56 +01:00
parent 1fee98f5dd
commit 30780db15b

View file

@ -270,6 +270,9 @@ transform (guint32 * src, guint32 * dest, gint video_area, gint factor)
guint32 in;
gint x, red, green, blue;
if (G_UNLIKELY (factor == 0))
return;
for (x = 0; x < video_area; x++) {
in = *src++;
@ -277,6 +280,12 @@ transform (guint32 * src, guint32 * dest, gint video_area, gint factor)
green = (in >> 8) & 0xff;
blue = (in) & 0xff;
if (factor == 0) {
red = 0;
green = 0;
blue = 0;
}
red = factor -
(((factor - red) * (factor - red) / factor) + ((green * red) / factor));
green = factor -