From: Tony Cook Date: Mon, 14 Feb 2011 08:07:54 +0000 (+1100) Subject: [rt.cpan.org #65391] test/fix transform2 sat op X-Git-Tag: Imager-0.81~1 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/52b0d318645c99287201535ed2fc12a09780094a [rt.cpan.org #65391] test/fix transform2 sat op --- diff --git a/Changes b/Changes index 390e0fcf..bff1a794 100644 --- a/Changes +++ b/Changes @@ -40,6 +40,9 @@ Bug fixes: - handle a slightly different warning from libtiff 4.x https://rt.cpan.org/Ticket/Display.html?id=65268 + - the sat transform2() op returned an incorrect saturation. + https://rt.cpan.org/Ticket/Display.html?id=65391 + Imager 0.80 - 17 Jan 2011 =========== diff --git a/regmach.c b/regmach.c index fa6578ee..c3d629cf 100644 --- a/regmach.c +++ b/regmach.c @@ -66,7 +66,7 @@ static double hsv_sat(i_color color) { return 0; } else { - int temp = i_min(i_max(color.rgb.r, color.rgb.g), color.rgb.b); + int temp = i_min(i_min(color.rgb.r, color.rgb.g), color.rgb.b); return (value - temp) / (double)value; } } diff --git a/t/t58trans2.t b/t/t58trans2.t index eca36381..ab569ff2 100644 --- a/t/t58trans2.t +++ b/t/t58trans2.t @@ -1,6 +1,6 @@ #!perl -w use strict; -use Test::More tests => 37; +use Test::More tests => 38; BEGIN { use_ok('Imager'); } use Imager::Test qw(is_color3); @@ -139,6 +139,9 @@ EOS op_test('800000', <<'EOS', 128, 0, 0, 'det'); 1 0 0 1 det 128 * 1 1 1 1 det 128 * 0 rgb EOS +op_test('FF80C0', <<'EOS', 127, 0, 0, 'sat'); +0 0 getp1 sat 255 * 0.01 + 0 0 rgb +EOS use Imager::Transform;