On Wed, 16 Dec 2020 00:42:24 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

>> For completeness, here is the patch for the snap-to-pixel issue:
>> 
>> diff --git 
>> a/modules/javafx.graphics/src/main/java/javafx/scene/layout/Region.java 
>> b/modules/javafx.graphics/src/main/java/javafx/scene/layout/Region.java
>> index 565d52b516..00c0f6da61 100644
>> --- a/modules/javafx.graphics/src/main/java/javafx/scene/layout/Region.java
>> +++ b/modules/javafx.graphics/src/main/java/javafx/scene/layout/Region.java
>> @@ -989,17 +989,11 @@ public class Region extends Parent {
>>      /** Called to update the cached snapped insets */
>>      private void updateSnappedInsets() {
>>          final Insets insets = getInsets();
>> -        if (_snapToPixel) {
>> -            snappedTopInset = Math.ceil(insets.getTop());
>> -            snappedRightInset = Math.ceil(insets.getRight());
>> -            snappedBottomInset = Math.ceil(insets.getBottom());
>> -            snappedLeftInset = Math.ceil(insets.getLeft());
>> -        } else {
>> -            snappedTopInset = insets.getTop();
>> -            snappedRightInset = insets.getRight();
>> -            snappedBottomInset = insets.getBottom();
>> -            snappedLeftInset = insets.getLeft();
>> -        }
>> +        final boolean snap = isSnapToPixel();
>> +        snappedTopInset = snapSizeY(insets.getTop(), snap);
>> +        snappedRightInset = snapSizeX(insets.getRight(), snap);
>> +        snappedBottomInset = snapSizeY(insets.getBottom(), snap);
>> +        snappedLeftInset = snapSizeX(insets.getLeft(), snap);
>>      }
>>  
>>      /**
>> 
>> We will need a test case for this. You can see 
>> [UIRenderSceneTest.java](https://github.com/openjdk/jfx/blob/master/tests/system/src/test/java/test/javafx/scene/UIRenderSceneTest.java)
>>  for an example of a test that forces Hi-DPI scaling.
>
> In looking at the other instances where snap-to-pixel is done correctly for 
> Insets, the above should use `snapSpace{X,Y}` rather than `snapSize{X,Y}`

I agree that it is better to separate the scrollpane issue from the cache 
rendering one.

I've reverted my initial changes and applied the changes you proposed (using 
snapSpaceX/Y as suggested in your latest comment). 
I'll also add a test case soon.

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

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

Reply via email to