8227392: Colors with alpha are painted incorrectly on Linux, after JDK-8214579
8224825: java/awt/Color/AlphaColorTest.java fails in linux-x64 system
Reviewed-by: prr
--- a/src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceData.java Tue Jul 16 10:48:22 2019 +0200
+++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceData.java Tue Jul 16 15:15:45 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, 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
@@ -54,7 +54,6 @@
import sun.java2d.pipe.ShapeDrawPipe;
import sun.java2d.pipe.TextPipe;
import sun.java2d.pipe.ValidatePipe;
-import sun.java2d.x11.X11SurfaceData;
import sun.java2d.x11.XSurfaceData;
import sun.font.FontManagerNativeLibrary;
@@ -244,7 +243,7 @@
*/
public static XRWindowSurfaceData createData(X11ComponentPeer peer) {
XRGraphicsConfig gc = getGC(peer);
- return new XRWindowSurfaceData(peer, gc, X11SurfaceData.getSurfaceType(gc, Transparency.OPAQUE));
+ return new XRWindowSurfaceData(peer, gc, gc.getSurfaceType());
}
/**
--- a/test/jdk/ProblemList.txt Tue Jul 16 10:48:22 2019 +0200
+++ b/test/jdk/ProblemList.txt Tue Jul 16 15:15:45 2019 +0100
@@ -114,7 +114,6 @@
# jdk_awt
-java/awt/Color/AlphaColorTest.java 8224825 linux-all
java/awt/event/MouseEvent/MouseClickTest/MouseClickTest.java 8168389 windows-all,macosx-all
java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java 8224055 macosx-all
java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowBlockingTest.java 8168408 windows-all,macosx-all
--- a/test/jdk/java/awt/Color/AlphaColorTest.java Tue Jul 16 10:48:22 2019 +0200
+++ b/test/jdk/java/awt/Color/AlphaColorTest.java Tue Jul 16 15:15:45 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
/**
* @test
* @key headful
- * @bug 8204931
+ * @bug 8204931 8227392 8224825
* @summary test alpha colors are blended with background.
*/
@@ -73,8 +73,14 @@
static Frame frame;
private static void createAndShowGUI() {
- frame = new Frame("Alpha Color Test");
- frame.setBackground(Color.black);
+ frame = new Frame("Alpha Color Test") {
+ @Override
+ public void paint(Graphics g) {
+ g.setColor(Color.black);
+ g.fillRect(0, 0, getWidth(), getHeight());
+ super.paint(g);
+ }
+ };
Color color = new Color(255, 255, 255, 127);
frame.add("Center", new AlphaColorTest(color));
frame.pack();