]> git.imager.perl.org - imager.git/commitdiff
[rt.cpan.org #65391] test/fix transform2 sat op
authorTony Cook <tony@develop-help.com>
Mon, 14 Feb 2011 08:07:54 +0000 (19:07 +1100)
committerTony Cook <tony@develop-help.com>
Mon, 14 Feb 2011 08:07:54 +0000 (19:07 +1100)
Changes
regmach.c
t/t58trans2.t

diff --git a/Changes b/Changes
index 390e0fcf000904104d44ac9210a517b3fee0df93..bff1a7941cea7eaa1b7a405d85714cf974e8c8f1 100644 (file)
--- 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
 ===========
 
index fa6578eeaf8bbd36f71a8eff751f9d2eb01c8625..c3d629cfb2cc1f8626aed4511768b4699a21a5e8 100644 (file)
--- 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;
   }
 }
index eca36381a315e4d22688efe0b1a20c56e86777ab..ab569ff2c0c19c5cc0441d18d46997e2b121ab24 100644 (file)
@@ -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;