[OpenJDK 2D-Dev] HiDPI support issues on Windows
Anton Tarasov
anton.tarasov at jetbrains.com
Fri Sep 30 16:34:32 UTC 2016
Hi Alexandr,
> On 30 Sep 2016, at 13:22, Alexandr Scherbatiy <alexandr.scherbatiy at oracle.com> wrote:
>
>
> Hello Anton,
>
> Yes, we are working on it.
>
> For example, there is the known issue DK-8162350 RepaintManager shifts repainted region when the floating point UI scale is used.
> https://bugs.openjdk.java.net/browse/JDK-8162350 <https://bugs.openjdk.java.net/browse/JDK-8162350>
Is it deferred to jdk10?
>
> The problem is that the RepaintManager draws a region to a buffered image at first and draws the image after that to the window.
> Suppose the image has int coordinates and size (x, y, w, h) in the user space. It should be drawn into the region with coordinates (x, y, x+width, y+height) = (x1, y1, x2, y2).
> If floating point UI scale is used (like 1.5) the region coordinates are converted to values (1.5 * x1, 1.5 * y1, 1.5 * x2, 1.5 * y2) in the dev space.
> Now these coordinates need to be rounded and the process really depends on the evenness or oddness of the start and end coordinates. They both can be rounded to one side or to opposite. Depending on this some lines near the drawn image region can be not filled or just wrongly filled.
Ok, thanks. Is there any good solution? Seems like the calculation should take into account originally painted regions. For your example from the bug’s comments, the dirty rect should have been calculated not relative to the parent’s origin (or to coord space origin), but relative to the origin of the originally painted primitive, to keep it consistent. This turns to the scene graph direction… Anything simpler?
>
> If I try to not use a buffered image in the RepaintManager it seems that some problems are just gone away (internal frame moving artifacts on the SwingSet2 demo or squares in MinimalSwingApplication are drawn as squares and not rectangles).
> But not all of them. The artifacts during the scrolling in the SwingSet2 demo still exist.
Do you mean you use VolatileImage, delegating the drawing to GPU (which solves it)? Or what?
>
> I have filled an issue on it just to keep track of them: JDK-8166954 Drawing artifacts with floating point UI scale
> https://bugs.openjdk.java.net/browse/JDK-8166954 <https://bugs.openjdk.java.net/browse/JDK-8166954>
Thanks. What about the wavy effect? Is the source of the problem the same?
>
> The another problem which we are working on is that a selected text is just shifted: 8156217 Selected text is shifted on HiDPI display
> https://bugs.openjdk.java.net/browse/JDK-8156217 <https://bugs.openjdk.java.net/browse/JDK-8156217>
>
> To support this we were needed to add some new API which support floating point coordinates in the View, TextUI and JTextComponent classes.
> The issue is on the review: http://mail.openjdk.java.net/pipermail/swing-dev/2016-September/006705.html <http://mail.openjdk.java.net/pipermail/swing-dev/2016-September/006705.html>
Ok, I’ll look into it closely.
Thanks a lot for the details!
Anton.
>
> Thanks,
> Alexandr.
>
> On 9/28/2016 1:17 PM, Anton Tarasov wrote:
>> Hello,
>>
>> JDK9 comes with HiDPI support on Windows/Linux which is really great. As we gave it a try, we found it looking pretty good with an integer scale (2x) but revealed some rendering flaws with float scales.
>>
>> Let me please demonstrate it with SwingSet2 + JDK9-ea-b137 + Windows 8.1 in 150% scale (1.5f)
>>
>> demo1 <http://cr.openjdk.java.net/%7Eant/hidpi_pics/demo1.png>
>>
>> Dragging Frame-0 behind the pallet makes the pallet wavy.
>> Also, as Frame-0 moves it may leave traces.
>>
>> demo2 <http://cr.openjdk.java.net/%7Eant/hidpi_pics/demo2.png>
>>
>> Unstable look of a control. For instance, these two combos are decorated differently (and not perfectly).
>>
>> demo3 <http://cr.openjdk.java.net/%7Eant/hidpi_pics/demo3.png>
>>
>> Scrolling traces.
>>
>> demo4 <http://cr.openjdk.java.net/%7Eant/hidpi_pics/demo4.png>
>>
>> Menu traces.
>> Colored rendering artifacts.
>>
>> Additionally, I'm attaching a test source & pics kindly provided by Renaud (cc'd) from AndroidStudio. The demo finely shows problems on the example of primitive rendering.
>>
>> Scaling 100% <http://cr.openjdk.java.net/%7Eant/hidpi_pics/Scaling-100-percent.png>
>>
>> Scaling 125% <http://cr.openjdk.java.net/%7Eant/hidpi_pics/Scaling-125-percent.png>
>>
>> Scaling 150% <http://cr.openjdk.java.net/%7Eant/hidpi_pics/Scaling-150-percent.png>
>>
>> It seems like most of the mentioned issues are caused by inaccurate rounding performed during the rendering cycle.
>>
>> So, I'd like to ask you please share your thoughts on it. How serious is the problem at all (I guess you're aware of it)? What is solvable on the JDK side, and what is not (e.g. demo2 and the Renaud's test case)?
>> Do you have plans to resolve it by jdk9 GA, or earlier/later? Any technical details behind it are very welcome as well.
>>
>> Thanks in advance,
>> Anton.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20160930/656989cd/attachment.html>
More information about the 2d-dev
mailing list