On Mon, 14 Mar 2022 16:15:47 GMT, Alisen Chung <ach...@openjdk.org> wrote:

>> Changed the drawing area to be increased by 0.5 on the left side to prevent 
>> clipping
>
> Alisen Chung has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   added functions for drawing border, fixed translate

Good catch. I'm not in a position to build this patch right now, but I suspect 
that if you put such a border in the right-hand-side of a splitter pane, then 
as you drag the splitter's divider, the light lines would still be jumping in 
and out from underneath the dark ones and/or 'jiggling' in width. (When tested 
at 125%, 175% etc)

> I believe it's because of rounding. I don't know how we can make sure the 
> lines are always drawn next to each other and always have the same thickness.

I believe the only way to get pixel-perfect (& balanced weight) rendering of 2 
lines next to each other at non-integer scale factors, when using integer based 
APIs like `drawLine`, will be to undo the affine transformation upon the 
pre-scaled `Graphics2D` object, and render it at 1x scaling. Then you'd need to 
decide how to compute the desired line thickness (like: should it jump 1px > 
2px at 150% scaling or 175% scaling?)

(IMHO, the JDK-9+ approach of passing in a pre-scaled Graphics object is a bit 
of a coarse approximation - useful for components that haven't natively 
considered HiDPI yet. I'm happy to see the built-in L&F code being improved in 
cases like this; while noting that there are many more.)

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

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

Reply via email to