-
Bug
-
Resolution: Fixed
-
P4
-
8u92
-
b124
-
x86
-
other
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8163700 | 8u121 | Alexandr Scherbatiy | P4 | Resolved | Fixed | b01 |
JDK-8159138 | 8u112 | Alexandr Scherbatiy | P4 | Resolved | Fixed | b01 |
JDK-8167826 | emb-8u121 | Alexandr Scherbatiy | P4 | Resolved | Fixed | b01 |
FULL PRODUCT VERSION :
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin saotome.local 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
When a high-dpi splashscreen is available (e.g. splash.png and splash@2x.png), the SplashScreen#getSize() and SplashScreen#getBounds methods return an incorrect size.
This is most likely caused by an incorrect implementation of the SplashScreen#getBounds method when the scale factor is applied:
if (scale > 0 && scale != 1) {
bounds.setSize((int) (bounds.getWidth() / scale),
(int) (bounds.getWidth() / scale));
}
This should become
if (scale > 0 && scale != 1) {
bounds.setSize((int) (bounds.getWidth() / scale),
(int) (bounds.getHeight() / scale));
}
Regression was introduced in this commit: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/4fa603c72f2f
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Compile the attached class (SplashScreenTest)
- Create a non-square regular and retina splash screen image (e.g. https://raw.githubusercontent.com/JetBrains/intellij-community/master/community-resources/src/idea_community_about.png and https://raw.githubusercontent.com/JetBrains/intellij-community/master/community-resources/src/idea_community_about%402x.png)
- Run the application on a high-dpi device (e.g. a recent Macbook) and specify the splash screen using -splash:path/to/splash.png
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The reported width and height of the splash screen are not the same, as the source image is a non-square image
ACTUAL -
The reported width and height of the splash screen are the same
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.SplashScreen;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.WindowConstants;
public class SplashScreenTest {
public static void main(String[] args) throws Exception{
SplashScreen splashScreen = SplashScreen.getSplashScreen();
Dimension size = splashScreen.getSize();
System.out.println("size = " + size);
if ( (size.getWidth() == size.getHeight())){
throw new RuntimeException("Width and height of the splash screen are the same, which shouldn't be the case");
}
Thread.sleep(2000);
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
showUI();
}
});
}
private static void showUI(){
JFrame frame = new JFrame("Test");
frame.getContentPane().add(new JLabel("Label"));
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.setVisible(true);
}
}
---------- END SOURCE ----------
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin saotome.local 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
When a high-dpi splashscreen is available (e.g. splash.png and splash@2x.png), the SplashScreen#getSize() and SplashScreen#getBounds methods return an incorrect size.
This is most likely caused by an incorrect implementation of the SplashScreen#getBounds method when the scale factor is applied:
if (scale > 0 && scale != 1) {
bounds.setSize((int) (bounds.getWidth() / scale),
(int) (bounds.getWidth() / scale));
}
This should become
if (scale > 0 && scale != 1) {
bounds.setSize((int) (bounds.getWidth() / scale),
(int) (bounds.getHeight() / scale));
}
Regression was introduced in this commit: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/4fa603c72f2f
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Compile the attached class (SplashScreenTest)
- Create a non-square regular and retina splash screen image (e.g. https://raw.githubusercontent.com/JetBrains/intellij-community/master/community-resources/src/idea_community_about.png and https://raw.githubusercontent.com/JetBrains/intellij-community/master/community-resources/src/idea_community_about%402x.png)
- Run the application on a high-dpi device (e.g. a recent Macbook) and specify the splash screen using -splash:path/to/splash.png
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The reported width and height of the splash screen are not the same, as the source image is a non-square image
ACTUAL -
The reported width and height of the splash screen are the same
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.SplashScreen;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.WindowConstants;
public class SplashScreenTest {
public static void main(String[] args) throws Exception{
SplashScreen splashScreen = SplashScreen.getSplashScreen();
Dimension size = splashScreen.getSize();
System.out.println("size = " + size);
if ( (size.getWidth() == size.getHeight())){
throw new RuntimeException("Width and height of the splash screen are the same, which shouldn't be the case");
}
Thread.sleep(2000);
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
showUI();
}
});
}
private static void showUI(){
JFrame frame = new JFrame("Test");
frame.getContentPane().add(new JLabel("Label"));
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.setVisible(true);
}
}
---------- END SOURCE ----------
- backported by
-
JDK-8159138 java.awt.SplashScreen.getSize() returns incorrect size for high dpi splash screens
-
- Resolved
-
-
JDK-8163700 java.awt.SplashScreen.getSize() returns incorrect size for high dpi splash screens
-
- Resolved
-
-
JDK-8167826 java.awt.SplashScreen.getSize() returns incorrect size for high dpi splash screens
-
- Resolved
-
- relates to
-
JDK-8145174 HiDPI splash screen support on Linux
-
- Resolved
-
-
JDK-8043869 [macosx] java -splash does not honor @2x hi dpi notation for retina support
-
- Resolved
-