jdk/src/share/classes/java/awt/SplashScreen.java
changeset 25552 96abb01815f6
parent 23010 6dadb192ad81
--- a/jdk/src/share/classes/java/awt/SplashScreen.java	Tue Jun 24 12:27:37 2014 +0400
+++ b/jdk/src/share/classes/java/awt/SplashScreen.java	Wed Jun 25 19:10:32 2014 +0400
@@ -245,7 +245,14 @@
     public Rectangle getBounds() throws IllegalStateException {
         synchronized (SplashScreen.class) {
             checkVisible();
-            return _getBounds(splashPtr);
+            float scale = _getScaleFactor(splashPtr);
+            Rectangle bounds = _getBounds(splashPtr);
+            assert scale > 0;
+            if (scale > 0 && scale != 1) {
+                bounds.setSize((int) (bounds.getWidth() / scale),
+                        (int) (bounds.getWidth() / scale));
+            }
+            return bounds;
         }
     }
 
@@ -287,10 +294,19 @@
     public Graphics2D createGraphics() throws IllegalStateException {
         synchronized (SplashScreen.class) {
             if (image==null) {
-                Dimension dim = getSize();
-                image = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB);
+                // get unscaled splash image size
+                Dimension dim = _getBounds(splashPtr).getSize();
+                image = new BufferedImage(dim.width, dim.height,
+                        BufferedImage.TYPE_INT_ARGB);
             }
-            return image.createGraphics();
+            float scale = _getScaleFactor(splashPtr);
+            Graphics2D g = image.createGraphics();
+            assert (scale > 0);
+            if (scale <= 0) {
+                scale = 1;
+            }
+            g.scale(scale, scale);
+            return g;
         }
     }
 
@@ -401,5 +417,6 @@
     private native static String _getImageFileName(long splashPtr);
     private native static String _getImageJarName(long SplashPtr);
     private native static boolean _setImageData(long SplashPtr, byte[] data);
+    private native static float _getScaleFactor(long SplashPtr);
 
 };