src/share/classes/java/awt/SplashScreen.java
Print this page
@@ -243,11 +243,17 @@
* @throws IllegalStateException if the splash screen has already been closed
*/
public Rectangle getBounds() throws IllegalStateException {
synchronized (SplashScreen.class) {
checkVisible();
- return _getBounds(splashPtr);
+ float scale = _getScaleFactor(splashPtr);
+ Rectangle bounds = _getBounds(splashPtr);
+ if (scale != 1) {
+ bounds.setSize((int) (bounds.getWidth() / scale),
+ (int) (bounds.getWidth() / scale));
+ }
+ return bounds;
}
}
/**
* Returns the size of the splash screen window as a {@link Dimension}.
@@ -285,14 +291,19 @@
* @throws IllegalStateException if the splash screen has already been closed
*/
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);
- }
- return image.createGraphics();
+ // get unscaled splash image size
+ Dimension dim = _getBounds(splashPtr).getSize();
+ image = new BufferedImage(dim.width, dim.height,
+ BufferedImage.TYPE_INT_ARGB);
+ }
+ float scale = _getScaleFactor(splashPtr);
+ Graphics2D g = image.createGraphics();
+ g.scale(scale, scale);
+ return g;
}
}
/**
* Updates the splash window with current contents of the overlay image.
@@ -399,7 +410,8 @@
private native static long _getInstance();
private native static void _close(long splashPtr);
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);
};