void /0 in Yxy2XYZ

Now sets 0 rather than inf.
This commit is contained in:
John Cupitt 2019-08-29 14:20:30 +01:00
parent 9a5dca1ef8
commit f8bdc00866

View File

@ -7,7 +7,9 @@
* - gtkdoc * - gtkdoc
* - cleanups * - cleanups
* 20/9/12 * 20/9/12
* redo as a class * - redo as a class
* 29/8/19
* - avoid /0
*/ */
/* /*
@ -67,18 +69,26 @@ vips_Yxy2XYZ_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
float x = p[1]; float x = p[1];
float y = p[2]; float y = p[2];
double total;
float X, Z; float X, Z;
p += 3; if( x == 0.0 ||
y == 0.0 ) {
X = 0.0;
Z = 0.0;
}
else {
double total;
total = Y / y; total = Y / y;
X = x * total; X = x * total;
Z = (X - x * X - x * Y) / x; Z = (X - x * X - x * Y) / x;
}
q[0] = X; q[0] = X;
q[1] = Y; q[1] = Y;
q[2] = Z; q[2] = Z;
p += 3;
q += 3; q += 3;
} }
} }