<AWT Dev> [13] Review Request: 8215105 java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java: Wrong Pixel Color

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Thu Mar 7 06:08:30 UTC 2019

Please review the fix for JDK 13.

Bug: https://bugs.openjdk.java.net/browse/JDK-8215105
Fix: http://cr.openjdk.java.net/~serb/8215105/webrev.00

Notes about the current implementation.
  1. The native system reads the pixels using the current "Display Profile".
  2. The robot API saves pixels into BufferedImage, which uses the sRGB color profile.
  3. To convert pixels from native representation to sRGB we used "kCGColorSpaceGenericRGB" mode.

Note that during conversion we may lost a color precision, this is why we always configured our test systems to use "Generic RGB Profiles"
But the logic above does not work on macOS 10.13.6.

I have tested macOS 10.12/13/14 and the only constant which works on all systems is a kCGColorSpaceSRGB + Display Profile "sRGB IEC 61966-2.1".
So we can:
  - Change nothing and skip "support" of 10.13.6 where "kCGColorSpaceGenericRGB" + "Generic RGB Profiles" does not work.
  - Apply the current fix, but then we need to change the requirement to the test systems(macos 10.12->10.14) to use "sRGB IEC 61966-2.1"

But since "kCGColorSpaceGenericRGB is available only for legacy reasons." it make sense to use kCGColorSpaceSRGB anyway.

Best regards, Sergey.

More information about the awt-dev mailing list