From 89a68018711fe35dc21d74144b6399246697bd69 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 13 Jun 2016 10:07:17 -0700 Subject: [PATCH] Tag AWT windows as sRGB surfaces OSX assumes windows are in the display's color space by default. Java2D assumes its output in sRGB, which means the sRGB colors are interpreted by the OS as being in the display's color space. This means that unless the display is set to use the sRGB color space, the final result on screen will look incorrect. Issue: 208508346 Change-Id: Ie4c8dd2e41ba4f92db0c59e94825512ea93c6553 --- src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m index 732c4b028550..748bafdf2424 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m @@ -463,6 +463,9 @@ - (id) initWithPlatformWindow:(jobject)platformWindow if (self.nsWindow == nil) return nil; // no hope either [self.nsWindow release]; // the property retains the object already + // Tell the system we have an sRGB backing store + [self.nsWindow setColorSpace: [NSColorSpace sRGBColorSpace]]; + self.isEnabled = YES; self.isMinimizing = NO; self.javaPlatformWindow = platformWindow;