On Fri, 8 Oct 2021 10:23:13 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
> In JDK 9 the native code for the robot class was reworked to get an access to > the HiDPI quality screenshots. So we allocate the data storage for the HiDPI > quality and then request the best quality from the macOS. > > It works fine if the user request the screenshot of some area, since we > properly scale this area. Unfortunately it does not work well if the user > request only one pixel, in this case we allocate the array of one element and > does not multiply the size by the scale, so if the system scale is 2 then the > macOS returns the 2x2 pixels, which does not fit properly to the array of one > element. This can be checked by the Xcheck:jni option which produce fatal > error in this case. > > Solution is to allocate the storage of the proper size 1 * scale * 1 * scale It seems CheckCommonColors still fails intermittently even with this fix in macos aarch64 along with others open/test/jdk/java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java, open/test/jdk/java/awt/ColorClass/AlphaColorTest.java, open/test/jdk/java/awt/AlphaComposite/WindowAlphaCompositeTest.java CheckCommonColors fails with this log ---------System.out:(3/175)---------- color = java.awt.Color[r=255,g=255,b=255], useRect = true color = java.awt.Color[r=255,g=255,b=255], useRect = false color = java.awt.Color[r=192,g=192,b=192], useRect = true ----------System.err:(17/897)---------- Expected: java.awt.Color[r=192,g=192,b=192] Actual: java.awt.Color[r=199,g=199,b=199] Point: java.awt.Point[x=960,y=600] Dump screen to: ScreenCapture.png ------------- PR: https://git.openjdk.java.net/jdk/pull/5864