RFR: 8316497 : ColorConvertOp - typo for non-ICC conversions needs one-line fix [v6]

Sergey Bylokhov serb at openjdk.org
Thu Jan 4 05:17:22 UTC 2024


On Thu, 4 Jan 2024 05:10:55 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> @aivanov-jdk Thank you for clarifying, I thought he mean to modify `toCIEXYZ` and `fromCIEXYZ`. Yes if we modify `toRGB `and `fromRGB` then it will not pass through fixed area, So we may need to skip this.
>
> The difference between srcColorSpace.fromCIEXYZ and dtsColorSpace.fromCIEXYZ can trigger an exception if both have different number of components, for example srcColorSpace = CS_GRAY and srcColorSpace.CS_sRGB =>ArrayIndexOutOfBoundsException will be triggered.
> 
> 
>     private static TestColorSpace createCS(boolean isSrc) {
>         ColorSpace cs = ColorSpace.getInstance(
>                 isSrc ? ColorSpace.CS_GRAY : ColorSpace.CS_sRGB);
>         return new TestColorSpace(cs);
>     }
> 
>     public static void main(String[] args) {
>         BufferedImage src = createTestImage(true);
>         BufferedImage dest = createTestImage(false);
> 
>         ColorSpace mid = ColorSpace.getInstance(ColorSpace.CS_sRGB);
>         ColorConvertOp test = new ColorConvertOp(mid, null);
>         test.filter(src, dest);
>     }
> 
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
> 	at java.desktop/java.awt.image.ColorConvertOp.nonICCBIFilter(ColorConvertOp.java:821)
> 	at java.desktop/java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:275)
> 	at NonICCFilterTest.main(NonICCFilterTest.java:97)

and instead of comparing that the images are just different, it is probably better to compare results of conversion via TestColorSpace wrapper vs ColorSpace w/o wrapper.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16895#discussion_r1441305407


More information about the client-libs-dev mailing list