JDK-8208072 : Colors with alpha are painted incorrectly on Linux
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 11
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux_ubuntu
  • CPU: x86_64
  • Submitted: 2018-07-16
  • Updated: 2018-07-25
  • Resolved: 2018-07-25
Related Reports
Duplicate :  
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
It seems that on Linux colors with an alpha transparency are painted incorrectly:

https://imgur.com/N1XuWCp

It may be related to this existing issue,
but I decided to report another bug just in case:
https://bugs.openjdk.java.net/browse/JDK-8204931

Painting off-screen is not affected (e.g. drawing to BufferedImage)

REGRESSION : Last worked in version 10.0.1

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Colors like in previous versions
ACTUAL -
Glitched colors

---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;

public class Test extends JFrame {

	Test() {
		JPanel p = new JPanel() {
			@Override
			protected void paintComponent(Graphics graphics) {
				Graphics2D g = (Graphics2D)graphics.create();

				g.setColor(Color.WHITE);
				g.fillRect(0, 0, getWidth(), getHeight());

				g.setColor(Color.RED);
				g.fillRect(200, 200, 200, 200);

				g.setComposite(AlphaComposite.SrcOver.derive(0.5f));

				g.setColor(new Color(133, 156, 178));
				g.fillRect(100, 100, 200, 200);

				g.setColor(Color.BLACK);
				g.fillRect(300, 300, 200, 200);

				g.setColor(Color.GREEN);
				g.fillRect(300, 100, 200, 200);

				g.dispose();
			}
		};
		add(p);

		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setSize(800, 600);
		setVisible(true);
	}

	public static void main(String... args) {
		SwingUtilities.invokeLater(Test::new);
	}

}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Works OK with -Dsun.java2d.xrender=false option

FREQUENCY : always



Comments
I am quite sure this is the same issue as the referenced bug 8204931 .. which needs a synopsis more like the one on this bug.
23-07-2018

In Linux environment, colors with an alpha transparency are not painted correctly. Checked this for reported JDK version 11 and could confirm the issue as reported. Results: ========== 10.0.2: OK 11 ea b23: Fail 12 ea b03: Fail This is a regression in JDK 11 in Linux as the issue does not occur in Windows environment. To verify, run the attached test case with respective JDK version.
23-07-2018