ColorModel.java (getUnnormalizedComponents, [...]): Fix calculation which was using...
authorScott Gilbertson <scottg@mantatest.com>
Sat, 30 Nov 2002 04:51:11 +0000 (04:51 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Sat, 30 Nov 2002 04:51:11 +0000 (04:51 +0000)
2002-11-29  Scott Gilbertson  <scottg@mantatest.com>

* java/awt/image/ColorModel.java (getUnnormalizedComponents,
getNormalizedComponents): Fix calculation which was using one too
many bits in the unnormalized format.

From-SVN: r59651

libjava/ChangeLog
libjava/java/awt/image/ColorModel.java

index 9206f99..3b6fd1a 100644 (file)
@@ -1,3 +1,9 @@
+2002-11-29  Scott Gilbertson  <scottg@mantatest.com>
+
+       * java/awt/image/ColorModel.java (getUnnormalizedComponents,
+       getNormalizedComponents): Fix calculation which was using one too
+       many bits in the unnormalized format.
+
 2002-11-29  Gary Benson  <gbenson@redhat.com>
 
        For PR libgcj/8759:
index 9cbbf4b..14a1b2e 100644 (file)
@@ -424,7 +424,7 @@ public abstract class ColorModel implements Transparency
     for (int i=0; i<numComponents; i++)
     {
       float in = normComponents[normOffset++];
-      int out = (int) (in * ((2<<getComponentSize(i)) - 1));
+      int out = (int) (in * ((1<<getComponentSize(i)) - 1));
       components[offset++] = out;
     }
     return components;
@@ -447,7 +447,7 @@ public abstract class ColorModel implements Transparency
     for (int i=0; i<numComponents; i++)
     {
       float in = components[offset++];
-      float out = in / ((2<<getComponentSize(i)) - 1);
+      float out = in / ((1<<getComponentSize(i)) - 1);
       normComponents[normOffset++] = out;
     }
     return normComponents;