ColorModel.java (getUnnormalizedComponents, [...]): Fix calculation which was using one too many bits in the unnormalized format.

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
This commit is contained in:
Scott Gilbertson 2002-11-30 04:51:11 +00:00 committed by Tom Tromey
parent 6d6661fe6f
commit 8ad3385a16
2 changed files with 8 additions and 2 deletions

View 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;