RFR: 8220484: JFXPanel renders a slanted image with a hidpi monitor scale of 125% or 175% [v5]

Kevin Rushforth kcr at openjdk.java.net
Wed Jul 8 22:20:51 UTC 2020


On Tue, 7 Jul 2020 12:34:17 GMT, Oliver Schmidtmer <github.com+10960818+Schmidor at openjdk.org> wrote:

>> In edge cases where monitor scaling of 1.25 or 1.75 is active, Math.ceil and Math.round produce different results and
>> EmbeddedScene#getPixels in JFXPanel#paintComponent causes an off-by-one error on the line width and therefore sheared
>> rendering.  The changes were already proposed by the submitter in JBS-8220484.
>> 
>> OCA is signed and send.
>
> Oliver Schmidtmer has updated the pull request incrementally with one additional commit since the last revision:
> 
>   move swt test

The test looks good with one minor typo in the constant field name (see below). I verified that it fails on Linux and
Mac (as I suspected), so you will need to limit the test to running on Windows.

modules/javafx.swt/src/test/java/test/javafx/embed/swt/FXCanvasScaledTest.java line 56:

> 55:     /* Base size, so that with a scaling of 125% there are different results for Math.round and Math.ceil */
> 56:     final static int TAGET_BASE_SIZE = 101;
> 57:

Spelling error: `TAGET` --> `TARGET`

tests/system/src/test/java/test/robot/javafx/embed/swing/JFXPanelScaledTest.java line 63:

> 62:     /* Base size, so that with a scaling of 125% there are different results for Math.round and Math.ceil */
> 63:     final static int TAGET_BASE_SIZE = 101;
> 64:

Spelling error: `TAGET` --> `TARGET`

tests/system/src/test/java/test/robot/javafx/embed/swing/JFXPanelScaledTest.java line 68:

> 67:     @BeforeClass
> 68:     public static void setupOnce() throws Exception {
> 69:         System.setProperty("sun.java2d.uiScale.enabled", "true");

You can add an `assumeTrue(PlatformUtil.isWindows());` here to ensure that the test only runs on Windows.

-------------

PR: https://git.openjdk.java.net/jfx/pull/246


More information about the openjfx-dev mailing list