From a114504915478658c3087bd873cb52d79409ecd3 Mon Sep 17 00:00:00 2001 From: alexsch Date: Thu, 9 Jun 2016 12:32:04 +0300 Subject: [PATCH] 8158178: java.awt.SplashScreen.getSize() returns incorrect size for high dpi splash screens Reviewed-by: alexsch, serb Contributed-by: Robin Stevens --- src/share/classes/java/awt/SplashScreen.java | 2 +- .../MultiResolutionSplash/MultiResolutionSplashTest.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/share/classes/java/awt/SplashScreen.java b/src/share/classes/java/awt/SplashScreen.java index 05a38e7e1..c51aa6fba 100644 --- a/src/share/classes/java/awt/SplashScreen.java +++ b/src/share/classes/java/awt/SplashScreen.java @@ -250,7 +250,7 @@ public final class SplashScreen { 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 index ec42aa9d7..a22d51fd8 100644 --- a/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java +++ b/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java @@ -93,6 +93,15 @@ public class MultiResolutionSplashTest { 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); -- GitLab