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.

Marked as reviewed by jdv (Reviewer).

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

PR: https://git.openjdk.java.net/jdk/pull/1373

Reply via email to