Better use of TIFFmin() macro to avoid side effects.

This commit is contained in:
Andrey Kiselev 2005-07-01 15:25:41 +00:00
parent 40c424104d
commit 74ff984d58

View File

@ -1,4 +1,4 @@
/* $Id: tif_color.c,v 1.9 2005-01-15 15:42:50 dron Exp $ */
/* $Id: tif_color.c,v 1.10 2005-07-01 15:25:41 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -88,27 +88,27 @@ TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z,
Yb = matrix[6] * X + matrix[7] * Y + matrix[8] * Z;
/* Clip input */
Yr = TIFFmax( Yr, cielab->display.d_Y0R );
Yg = TIFFmax( Yg, cielab->display.d_Y0G );
Yb = TIFFmax( Yb, cielab->display.d_Y0B );
Yr = TIFFmax(Yr, cielab->display.d_Y0R);
Yg = TIFFmax(Yg, cielab->display.d_Y0G);
Yb = TIFFmax(Yb, cielab->display.d_Y0B);
/* Turn luminosity to colour value. */
i = TIFFmin(cielab->range,
(int)((Yr - cielab->display.d_Y0R) / cielab->rstep));
i = (int)((Yr - cielab->display.d_Y0R) / cielab->rstep);
i = TIFFmin(cielab->range, i);
*r = RINT(cielab->Yr2r[i]);
i = TIFFmin(cielab->range,
(int)((Yg - cielab->display.d_Y0G) / cielab->gstep));
i = (int)((Yg - cielab->display.d_Y0G) / cielab->gstep);
i = TIFFmin(cielab->range, i);
*g = RINT(cielab->Yg2g[i]);
i = TIFFmin(cielab->range,
(int)((Yb - cielab->display.d_Y0B) / cielab->bstep));
i = (int)((Yb - cielab->display.d_Y0B) / cielab->bstep);
i = TIFFmin(cielab->range, i);
*b = RINT(cielab->Yb2b[i]);
/* Clip output. */
*r = TIFFmin( *r, cielab->display.d_Vrwr );
*g = TIFFmin( *g, cielab->display.d_Vrwg );
*b = TIFFmin( *b, cielab->display.d_Vrwb );
*r = TIFFmin(*r, cielab->display.d_Vrwr);
*g = TIFFmin(*g, cielab->display.d_Vrwg);
*b = TIFFmin(*b, cielab->display.d_Vrwb);
}
#undef RINT