提交 a1145049 编写于 作者: A alexsch

8158178: java.awt.SplashScreen.getSize() returns incorrect size for high dpi splash screens

Reviewed-by: alexsch, serb
Contributed-by: NRobin Stevens <robin.stevens@scz.be>
上级 c9da3575
...@@ -250,7 +250,7 @@ public final class SplashScreen { ...@@ -250,7 +250,7 @@ public final class SplashScreen {
assert scale > 0; assert scale > 0;
if (scale > 0 && scale != 1) { if (scale > 0 && scale != 1) {
bounds.setSize((int) (bounds.getWidth() / scale), bounds.setSize((int) (bounds.getWidth() / scale),
(int) (bounds.getWidth() / scale)); (int) (bounds.getHeight() / scale));
} }
return bounds; return bounds;
} }
......
...@@ -93,6 +93,15 @@ public class MultiResolutionSplashTest { ...@@ -93,6 +93,15 @@ public class MultiResolutionSplashTest {
int screenX = (int) splashBounds.getCenterX(); int screenX = (int) splashBounds.getCenterX();
int screenY = (int) splashBounds.getCenterY(); 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(); Robot robot = new Robot();
Color splashScreenColor = robot.getPixelColor(screenX, screenY); Color splashScreenColor = robot.getPixelColor(screenX, screenY);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册