From a99e7d674f69dea8d15ce66cdd9ccfc927f190d4 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 5 May 2023 18:24:27 +0000 Subject: [PATCH] 8298887: On the latest macOS+XCode the Robot API may report wrong colors Reviewed-by: phh Backport-of: 50120396b6cca1219fb5dd42a11e4b29b79bd3bd --- jdk/src/macosx/native/sun/awt/CRobot.m | 6 +----- jdk/src/macosx/native/sun/awt/QuartzSurfaceData.h | 10 +--------- .../awt/Robot/CheckCommonColors/CheckCommonColors.java | 4 +--- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/jdk/src/macosx/native/sun/awt/CRobot.m b/jdk/src/macosx/native/sun/awt/CRobot.m index 1b85de1dbb3..7adc80d3382 100644 --- a/jdk/src/macosx/native/sun/awt/CRobot.m +++ b/jdk/src/macosx/native/sun/awt/CRobot.m @@ -47,10 +47,6 @@ #define k_JAVA_ROBOT_WHEEL_COUNT 1 -#if !defined(kCGBitmapByteOrder32Host) -#define kCGBitmapByteOrder32Host 0 -#endif - // In OS X, left and right mouse button share the same click count. // That is, if one starts clicking the left button rapidly and then // switches to the right button, then the click count will continue @@ -324,7 +320,7 @@ static void PostMouseEvent(const CGPoint point, CGMouseButton button, 8, picWidth * sizeof(jint), picColorSpace, kCGBitmapByteOrder32Host | - kCGImageAlphaPremultipliedFirst); + kCGImageAlphaNoneSkipFirst); CGColorSpaceRelease(picColorSpace); diff --git a/jdk/src/macosx/native/sun/awt/QuartzSurfaceData.h b/jdk/src/macosx/native/sun/awt/QuartzSurfaceData.h index 8d4a8a246b0..1db951147a2 100644 --- a/jdk/src/macosx/native/sun/awt/QuartzSurfaceData.h +++ b/jdk/src/macosx/native/sun/awt/QuartzSurfaceData.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,14 +28,6 @@ #import "AWTFont.h" #import -// these flags are not defined on Tiger on PPC, so we need to make them a no-op -#if !defined(kCGBitmapByteOrder32Host) -#define kCGBitmapByteOrder32Host 0 -#endif -#if !defined(kCGBitmapByteOrder16Host) -#define kCGBitmapByteOrder16Host 0 -#endif - // NOTE : Modify the printSurfaceDataDiagnostics API if you change this enum enum SDRenderType { diff --git a/jdk/test/java/awt/Robot/CheckCommonColors/CheckCommonColors.java b/jdk/test/java/awt/Robot/CheckCommonColors/CheckCommonColors.java index 9e705e6ef0f..2f919514a04 100644 --- a/jdk/test/java/awt/Robot/CheckCommonColors/CheckCommonColors.java +++ b/jdk/test/java/awt/Robot/CheckCommonColors/CheckCommonColors.java @@ -31,14 +31,12 @@ import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; -import java.util.List; - import javax.imageio.ImageIO; /** * @test * @key headful - * @bug 8215105 + * @bug 8215105 8211999 8298887 * @summary tests that Robot can capture the common colors without artifacts */ public final class CheckCommonColors {