Bill Skaggs <weskaggs@primate.ucdavis.edu>

* plug-ins/common/decompose.c: clamp results of LAB decomposition
	so that out-of-gamut conversions do not overflow and get
	badly distorted.  Fixes bug #147603.  Note that it would probably
	be a good idea to do similar things for other conversion types.
This commit is contained in:
William Skaggs 2004-07-25 21:02:31 +00:00
parent 5658cb1a56
commit 2a803755fd
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2004-07-25 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* plug-ins/common/decompose.c: clamp results of LAB decomposition
so that out-of-gamut conversions do not overflow and get
badly distorted. Fixes bug #147603. Note that it would probably
be a good idea to do similar things for other conversion types.
2004-07-25 Shlomi Fish <shlomif@iglu.org.il>
* plug-ins/gimpressionist/: converted checks for initialization of

View File

@ -1043,9 +1043,9 @@ extract_lab (guchar *src,
ftx = ((tx = x/Xn) > 0.008856) ? cbrt (tx) : 7.78 * tx + sixteenth;
ftz = ((tz = z/Zn) > 0.008856) ? cbrt (tz) : 7.78 * tz + sixteenth;
*l_dst++ = (guchar) (l * 2.5599);
*a_dst++ = (guchar) (128.0 + (ftx - fty) * 635 );
*b_dst++ = (guchar) (128.0 + (fty - ftz) * 254 );
*l_dst++ = (guchar) CLAMP (l * 2.5599, 0., 256.);
*a_dst++ = (guchar) CLAMP (128.0 + (ftx - fty) * 635, 0., 256.);
*b_dst++ = (guchar) CLAMP (128.0 + (fty - ftz) * 254, 0., 256.);
rgb_src += offset;
}