changeset 11703:444346a90b1e

8158178: java.awt.SplashScreen.getSize() returns incorrect size for high dpi splash screens Reviewed-by: alexsch, serb Contributed-by: Robin Stevens <robin.stevens@scz.be>
author alexsch
date Thu, 09 Jun 2016 12:32:04 +0300
parents 267a03dfb105
children fe5b73da2569
files src/share/classes/java/awt/SplashScreen.java test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/awt/SplashScreen.java	Mon Jun 06 22:39:03 2016 +0000
+++ b/src/share/classes/java/awt/SplashScreen.java	Thu Jun 09 12:32:04 2016 +0300
@@ -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;
         }
--- a/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java	Mon Jun 06 22:39:03 2016 +0000
+++ b/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java	Thu Jun 09 12:32:04 2016 +0300
@@ -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);