On Fri, 29 Aug 2025 06:53:29 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:

>> We have a few places in the cmm code where the fast-code-path assumes that 
>> standard buffered images with type such as TYPE_INT_ARGB_PRE use our private 
>> raster implementation such as IntegerComponentRaster, which is not 
>> necessarily true. Casting to these private raster types can result in a 
>> ClassCastException.
>> 
>> The patch will detect such custom images and fall back to the slow path for 
>> conversion.
>
> Sergey Bylokhov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Update FilterSemiCustomImages.java

Overall, looks good to me except for a couple minor comments.

Without the fix, the test throws `ClassCastException`, doesn't it?

test/jdk/sun/java2d/cmm/ColorConvertOp/FilterSemiCustomImages.java line 87:

> 85:     private static void test(int fromIndex, int toIndex, int type)
> 86:             throws Exception
> 87:     {

Suggestion:

    private static void test(int fromIndex, int toIndex, int type)
            throws Exception {

Java code style prefers the opening brace is on the same line instead of its 
own line.

test/jdk/sun/java2d/cmm/ColorConvertOp/FilterSemiCustomImages.java line 142:

> 140:                 Color c = new Color(y * 255 / (height - 1),
> 141:                                     x * 255 / (width - 1),
> 142:                                     x % 255, (x % 2 == 0) ? 0 : 255);

Suggestion:

                Color c = new Color(y * 255 / (height - 1),
                                    x * 255 / (width - 1),
                                    x % 255,
                                    (x % 2 == 0) ? 0 : 255);

This way the fourth parameter stands out.

test/jdk/sun/java2d/cmm/ColorConvertOp/FilterSemiCustomImages.java line 150:

> 148:     private static void verify(BufferedImage dstGold, BufferedImage dst)
> 149:             throws Exception
> 150:     {

Suggestion:

    private static void verify(BufferedImage dstGold, BufferedImage dst)
            throws Exception {

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

Changes requested by aivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26994#pullrequestreview-3167909578
PR Review Comment: https://git.openjdk.org/jdk/pull/26994#discussion_r2309570121
PR Review Comment: https://git.openjdk.org/jdk/pull/26994#discussion_r2309580484
PR Review Comment: https://git.openjdk.org/jdk/pull/26994#discussion_r2309581585

Reply via email to