> As discussed in the [JBS 
> issue](https://bugs.openjdk.java.net/browse/JDK-8199592), when snapping an 
> already snapped value (either intentionally or by  mistake), the result 
> should be the same, otherwise we'll be jumping unnecessary from a valid pixel 
> to another pixel.
> 
> This PR provides a fix to `snapSizeXX` methods used in `Region`, which 
> ultimately use `Math.ceil`, by subtracting an epsilon value to scaled value 
> before ceiling, to ensure snapping a snapped value gives the same value.
> 
> A test to verify `snapSizeX` and `snapSizeY` with 1000 random values, and 6 
> different UI scales is provided.
> For the 1.0, 1.25, 1.5 and 2.0 UI scales, the current approach works fine. 
> Only for 1.75 and the random 1.374562997 value fails (the test fails for 
> around 2% of the values with 1.75 and around 10% with 1.374562997).
> With the proposed fix, it doesn't fail at all.

Jose Pereda has updated the pull request incrementally with one additional 
commit since the last revision:

  Apply fix to snapPortionXX methods, extend test.

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

Changes:
  - all: https://git.openjdk.java.net/jfx/pull/336/files
  - new: https://git.openjdk.java.net/jfx/pull/336/files/216868f1..2b8e15eb

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jfx&pr=336&range=04
 - incr: https://webrevs.openjdk.java.net/?repo=jfx&pr=336&range=03-04

  Stats: 58 lines in 3 files changed: 54 ins; 0 del; 4 mod
  Patch: https://git.openjdk.java.net/jfx/pull/336.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/336/head:pull/336

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

Reply via email to