Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8298887

On the latest macOS+XCode the Robot API may report wrong colors

    XMLWordPrintable

Details

    • b04

    Backports

      Description

        After upgrading to the latest xcode(14.2)+macOS(12.6.1 or 13.0.1) I have found that some of the robot related tests start to fail.

        The root cause is here:
        https://github.com/openjdk/jdk/blob/master/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m#L352

        Note that we would like to get from native kCGBitmapByteOrder32Host and kCGImageAlphaPremultipliedFirst
            CGContextRef jPicContextRef = CGBitmapContextCreate(
                                                    jPixelData,
                                                    picWidth, picHeight,
                                                    8, picWidth * sizeof(jint),
                                                    picColorSpace,
                                                    kCGBitmapByteOrder32Host |
                                                    kCGImageAlphaPremultipliedFirst);

        But kCGBitmapByteOrder32Host might not be what we expected in the java.
        And looks like the kCGImageAlphaPremultipliedFirst is always wrong:
        https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/java/awt/Robot.java#L521

        Attachments

          Issue Links

            Activity

              People

                serb Sergey Bylokhov
                serb Sergey Bylokhov
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: