RFR: 8220484: JFXPanel renders a slanted image with a hidpi monitor scale of 125% or 175%
github.com+10960818+Schmidor at openjdk.java.net
Fri Jun 12 21:14:41 UTC 2020
On Fri, 12 Jun 2020 20:43:18 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> @Schmidor in general, we don't use the `/issue` command to identify other issues that happen to be fixed by a commit.
>> Rather, if they are the same bug, or if one is caused by the other, we would closed the other one as a duplicate. This
>> seems like a good thing for me to add to the [CONTRIBUTING](https://github.com/openjdk/jfx/blob/master/CONTRIBUTING.md)
> Even though this is a seemingly simple fix, I'd like @prsadhuk to also review it.
> @Schmidor Can you do the following?
> 1. Provide an evaluation as to why this is the correct fix, and indicate what testing you have done to ensure no
> regressions in behavior. Changes to rounding in width and height computations tend to be trickier than they might seem.
> 2. Provide a test as part of this fix. Ideally, this would be an automated test, in the system tests project (under
> `tests/system`), and should set the `glass.win.uiScale` system property to `1.25` before running the test. There are a
> few examples you can follow under tests/system that create a JFrame with a JFXPanel and use Robot to verify the
> rendered image. If it turns out that an automated is not feasible, a manual test would be an acceptable alternative. 3.
> Enter the `/issue remove 8230007` command to remove that issue from this PR. I've already closed
> [JDK-8230007](https://bugs.openjdk.java.net/browse/JDK-8230007) in JBS as a duplicate.
I'll look into a more detailed description with code references and try to create a test.
The backbuffer of the Stage is created with Math.round(baseSize*uiScale) and for Swing the DataBuffer is referenced
into an BufferdImage, where the bounds are calculated with Math.ceil(baseSize*uiScale). So when the base-width is 101px
and uiscale is 1.25, the unrounded size is 126.25. The real buffer-width is then 126px, but rendered in swing using
127px. So there is an offset of one pixel per line and the resulting image is skewed.
More information about the openjfx-dev