<AWT Dev> [PATCH] 8043869 [macosx] java -splash does not honor @2x hi dpi notation for retina support
Robin Stevens
robin.stevens at scz.be
Mon May 30 17:05:55 UTC 2016
Hello,
the patch for JDK-8043869 (introduced with change
http://cr.openjdk.java.net/~alexsch/8043869/webrev.03/) contains a bug.
The java.awt.SplashScreen#getSize returns an incorrect height value when a
hi dpi splash screen is shown. There is no bug available yet in the public
JIRA bug tracker, although I submitted a bug report for this through
http://bugs.java.com/ .
The following patch fixes that problem, and updates the test to detect the
problem:
diff --git a/src/share/classes/java/awt/SplashScreen.java
b/src/share/classes/java/awt/SplashScreen.java
--- a/src/share/classes/java/awt/SplashScreen.java
+++ b/src/share/classes/java/awt/SplashScreen.java
@@ -250,7 +250,7 @@
assert scale > 0;
if (scale > 0 && scale != 1) {
bounds.setSize((int) (bounds.getWidth() / scale),
- (int) (bounds.getWidth() / scale));
+ (int) (bounds.getHeight() / scale));
}
return bounds;
}
diff --git
a/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
b/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
---
a/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
+++
b/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
@@ -93,6 +93,15 @@
int screenX = (int) splashBounds.getCenterX();
int screenY = (int) splashBounds.getCenterY();
+ if(splashBounds.width != IMAGE_WIDTH){
+ throw new RuntimeException(
+ "SplashScreen#getBounds has wrong width");
+ }
+ if(splashBounds.height != IMAGE_HEIGHT){
+ throw new RuntimeException(
+ "SplashScreen#getBounds has wrong height");
+ }
+
Robot robot = new Robot();
Color splashScreenColor = robot.getPixelColor(screenX, screenY);
Diff was created against this revision:
http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/rev/4d6c03fb1039
Note that this is my first contribution. I think I followed all the
guidelines from http://openjdk.java.net/contribute/ . Please let me know if
I did anything wrong.
Kind regards,
Robin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20160530/4a088c9e/attachment-0001.html>
More information about the awt-dev
mailing list