Details
-
Bug
-
Resolution: Fixed
-
P3
-
jfx11
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8249883 | jfx16 | Kevin Rushforth | P3 | Resolved | Fixed | |
JDK-8253642 | jfx11.0.9 | Prasanta Sadhukhan | P3 | Closed | Fixed |
Description
ADDITIONAL SYSTEM INFORMATION :
A monitor (can be the main monitor) is configured to scale text/apps/etc. to 125% or 175%. The bug does not appear without scale or with 150%/200% scale.
A DESCRIPTION OF THE PROBLEM :
When using a hidpi monitor on Windows, configured to scale everything with 125% or 175%, certain sizes of a JFXPanel instance (most likely those that when multiplied with 1.25 or 1.75 end on .25, i.e. Math.ceil() and Math.round() matters) look "slanted". More exactly, it looks like an image is drawn pixel-wise, from top to bottom, into an area that is 1 pixel wider than the image. The left border flips to the right side and moves into direction southwest.
REGRESSION : Last worked in version 8u201
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the SlantedTester and change the width of the window. At some point the whole button becomes slanted. This does not change even when interacting with the button or moving the window. It is "fixed" by changing the width to a non-problematic again.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The button should always look normal.
ACTUAL -
The button looks slanted.
---------- BEGIN SOURCE ----------
import java.awt.Dimension;
import javax.swing.JFrame;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.Button;
public class SlantedTester
{
public static void main(String[] args)
{
new SlantedTester().init();
}
private void init()
{
JFXPanel fxPanel = new JFXPanel();
fxPanel.setPreferredSize(new Dimension(600, 400));
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Platform.runLater(() -> initFX(fxPanel));
frame.add(fxPanel);
frame.pack();
frame.setVisible(true);
}
private void initFX(JFXPanel fxPanel)
{
Scene scene = createScene();
fxPanel.setScene(scene);
}
private Scene createScene()
{
return new Scene(new Button("Button"));
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
When using
int newPixelW = (int) Math.round(pWidth * newScaleFactorX);
int newPixelH = (int) Math.round(pHeight * newScaleFactorY);
instead of Math.ceil() in JFXPanel.createResizePixelBuffer() this bug does not appear.
FREQUENCY : always
A monitor (can be the main monitor) is configured to scale text/apps/etc. to 125% or 175%. The bug does not appear without scale or with 150%/200% scale.
A DESCRIPTION OF THE PROBLEM :
When using a hidpi monitor on Windows, configured to scale everything with 125% or 175%, certain sizes of a JFXPanel instance (most likely those that when multiplied with 1.25 or 1.75 end on .25, i.e. Math.ceil() and Math.round() matters) look "slanted". More exactly, it looks like an image is drawn pixel-wise, from top to bottom, into an area that is 1 pixel wider than the image. The left border flips to the right side and moves into direction southwest.
REGRESSION : Last worked in version 8u201
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the SlantedTester and change the width of the window. At some point the whole button becomes slanted. This does not change even when interacting with the button or moving the window. It is "fixed" by changing the width to a non-problematic again.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The button should always look normal.
ACTUAL -
The button looks slanted.
---------- BEGIN SOURCE ----------
import java.awt.Dimension;
import javax.swing.JFrame;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.Button;
public class SlantedTester
{
public static void main(String[] args)
{
new SlantedTester().init();
}
private void init()
{
JFXPanel fxPanel = new JFXPanel();
fxPanel.setPreferredSize(new Dimension(600, 400));
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Platform.runLater(() -> initFX(fxPanel));
frame.add(fxPanel);
frame.pack();
frame.setVisible(true);
}
private void initFX(JFXPanel fxPanel)
{
Scene scene = createScene();
fxPanel.setScene(scene);
}
private Scene createScene()
{
return new Scene(new Button("Button"));
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
When using
int newPixelW = (int) Math.round(pWidth * newScaleFactorX);
int newPixelH = (int) Math.round(pHeight * newScaleFactorY);
instead of Math.ceil() in JFXPanel.createResizePixelBuffer() this bug does not appear.
FREQUENCY : always
Attachments
Issue Links
- backported by
-
JDK-8249883 JFXPanel renders a slanted image with a hidpi monitor scale of 125% or 175%
- Resolved
-
JDK-8253642 JFXPanel renders a slanted image with a hidpi monitor scale of 125% or 175%
- Closed
- duplicates
-
JDK-8230007 HiDPI scaling (125%) makes WebView in JFXPanel have a skewed/tilted rendering
- Closed
- relates to
-
JDK-8247541 Blur when drawing on Canvas with HighDPI enabled
- Open
(1 links to)