On Sun, 22 Nov 2020 08:59:48 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
> The problem became visible, when we draw a border across the component using > drawLine, and expected that fillRect will clear a border of the component. > This is incorrect because in the case of the scaled graphics(retina) some > part of the line can be placed outside of the bounds of the rectangle. See > additional information here: > https://bugs.openjdk.java.net/browse/JDK-8011764 > > This bug has occurred when the old default metal theme is > used(DefaultMetalTheme) or thems based on it(Custom themes in the SwingSet2). > > The fix applies the clip before the rendering so the paint method will not > touch pixels outside the component. > > As a fix, we could try to draw the lines using subpixel coordinates, but that > code is expected to work using Graphics object(unlike current default metal > theme: Ocean) which uses the only int as a coordinate, not a Graphics2D > > To make rendering a little bit better I tried antialiasing but it does not > produce a better result, so did not use it in the fix. This pull request has now been integrated. Changeset: 9d7121c1 Author: Sergey Bylokhov <s...@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/9d7121c1 Stats: 192 lines in 3 files changed: 177 ins; 2 del; 13 mod 8256713: SwingSet2 : Slider leaves tracks in uiScale=2 Reviewed-by: jdv, psadhukhan ------------- PR: https://git.openjdk.java.net/jdk/pull/1373