<Swing Dev> [10] Review Request 8187367: Numerous swing display problems with scaled displays on Windows

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

<Swing Dev> [10] Review Request 8187367: Numerous swing display problems with scaled displays on Windows

Semyon Sadetsky
Hello,

Please review fix for JDK10 (in Swing and Java2D):

bug: https://bugs.openjdk.java.net/browse/JDK-8187367

webrev: http://cr.openjdk.java.net/~ssadetsky/8187367/webrev.00/

Swing apps  may have artifacts on HiDPI screens with fractional scales.
There are several issues which may cause various artifacts but the
current fix only eliminates one type of artifacts the vertical and
horizontal lines on painted surfaces (other issues are addressed by [1]
and [2]). This issue was introduced after 8073320 and then incorrectly
fixed in 8163193.

The root cause is the painter pattern is drawn on a wrongly sized and
scaled image in case the image is an off-screen volatile image. The
painter doesn't take into account the volatile image inner scale
transformation which is not an identity in case of HiDPI , so the
resulting image is drawn on of off-screen surface that in the scale
times bigger than it is actually necessary. Since such images are cached
this was waste of RAM. Also, the bounds sent to the painter class don't
take into account the transformation rounding error the latter caused
artifacts on the drawing edges.

--Semyon

[1] https://bugs.openjdk.java.net/browse/JDK-8187585

[2] https://bugs.openjdk.java.net/browse/JDK-8187586

Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10] Review Request 8187367: Numerous swing display problems with scaled displays on Windows

Sergey Bylokhov
Hi, Semyon.
Is it possible to write a test case for this issue? It will be helpful
to understand the bug and a fix.

On 9/18/17 09:36, Semyon Sadetsky wrote:

> Hello,
>
> Please review fix for JDK10 (in Swing and Java2D):
>
> bug: https://bugs.openjdk.java.net/browse/JDK-8187367
>
> webrev: http://cr.openjdk.java.net/~ssadetsky/8187367/webrev.00/
>
> Swing apps  may have artifacts on HiDPI screens with fractional scales.
> There are several issues which may cause various artifacts but the
> current fix only eliminates one type of artifacts the vertical and
> horizontal lines on painted surfaces (other issues are addressed by [1]
> and [2]). This issue was introduced after 8073320 and then incorrectly
> fixed in 8163193.
>
> The root cause is the painter pattern is drawn on a wrongly sized and
> scaled image in case the image is an off-screen volatile image. The
> painter doesn't take into account the volatile image inner scale
> transformation which is not an identity in case of HiDPI , so the
> resulting image is drawn on of off-screen surface that in the scale
> times bigger than it is actually necessary. Since such images are cached
> this was waste of RAM. Also, the bounds sent to the painter class don't
> take into account the transformation rounding error the latter caused
> artifacts on the drawing edges.
>
> --Semyon
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8187585
>
> [2] https://bugs.openjdk.java.net/browse/JDK-8187586
>


--
Best regards, Sergey.
Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10] Review Request 8187367: Numerous swing display problems with scaled displays on Windows

Semyon Sadetsky
On 09/18/2017 12:01 PM, Sergey Bylokhov wrote:
> Hi, Semyon.
> Is it possible to write a test case for this issue? It will be helpful
> to understand the bug and a fix.

Writing the test is hard because those inner interfaces are  too deep
inside. You can use SwingSet2 demo to see the described artifacts at
fractional scales before the fix.

>
> On 9/18/17 09:36, Semyon Sadetsky wrote:
>> Hello,
>>
>> Please review fix for JDK10 (in Swing and Java2D):
>>
>> bug: https://bugs.openjdk.java.net/browse/JDK-8187367
>>
>> webrev: http://cr.openjdk.java.net/~ssadetsky/8187367/webrev.00/
>>
>> Swing apps  may have artifacts on HiDPI screens with fractional
>> scales. There are several issues which may cause various artifacts
>> but the current fix only eliminates one type of artifacts the
>> vertical and horizontal lines on painted surfaces (other issues are
>> addressed by [1] and [2]). This issue was introduced after 8073320
>> and then incorrectly fixed in 8163193.
>>
>> The root cause is the painter pattern is drawn on a wrongly sized and
>> scaled image in case the image is an off-screen volatile image. The
>> painter doesn't take into account the volatile image inner scale
>> transformation which is not an identity in case of HiDPI , so the
>> resulting image is drawn on of off-screen surface that in the scale
>> times bigger than it is actually necessary. Since such images are
>> cached this was waste of RAM. Also, the bounds sent to the painter
>> class don't take into account the transformation rounding error the
>> latter caused artifacts on the drawing edges.
>>
>> --Semyon
>>
>> [1] https://bugs.openjdk.java.net/browse/JDK-8187585
>>
>> [2] https://bugs.openjdk.java.net/browse/JDK-8187586
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10] Review Request 8187367: Numerous swing display problems with scaled displays on Windows

Phil Race
I think we should push this fix, although there are concerns we can't
immediately demonstrate
that Math.ceil may be wrong in some theoretical case.

Also Sergey, please add a comment in the bug report about the
alternative fix you mentioned
that was discussed previously so that can be re-visited if we
subsequently find problems as a result of this fix.

-phil.

On 09/19/2017 07:58 AM, Semyon Sadetsky wrote:

> On 09/18/2017 12:01 PM, Sergey Bylokhov wrote:
>> Hi, Semyon.
>> Is it possible to write a test case for this issue? It will be
>> helpful to understand the bug and a fix.
>
> Writing the test is hard because those inner interfaces are  too deep
> inside. You can use SwingSet2 demo to see the described artifacts at
> fractional scales before the fix.
>
>>
>> On 9/18/17 09:36, Semyon Sadetsky wrote:
>>> Hello,
>>>
>>> Please review fix for JDK10 (in Swing and Java2D):
>>>
>>> bug: https://bugs.openjdk.java.net/browse/JDK-8187367
>>>
>>> webrev: http://cr.openjdk.java.net/~ssadetsky/8187367/webrev.00/
>>>
>>> Swing apps  may have artifacts on HiDPI screens with fractional
>>> scales. There are several issues which may cause various artifacts
>>> but the current fix only eliminates one type of artifacts the
>>> vertical and horizontal lines on painted surfaces (other issues are
>>> addressed by [1] and [2]). This issue was introduced after 8073320
>>> and then incorrectly fixed in 8163193.
>>>
>>> The root cause is the painter pattern is drawn on a wrongly sized
>>> and scaled image in case the image is an off-screen volatile image.
>>> The painter doesn't take into account the volatile image inner scale
>>> transformation which is not an identity in case of HiDPI , so the
>>> resulting image is drawn on of off-screen surface that in the scale
>>> times bigger than it is actually necessary. Since such images are
>>> cached this was waste of RAM. Also, the bounds sent to the painter
>>> class don't take into account the transformation rounding error the
>>> latter caused artifacts on the drawing edges.
>>>
>>> --Semyon
>>>
>>> [1] https://bugs.openjdk.java.net/browse/JDK-8187585
>>>
>>> [2] https://bugs.openjdk.java.net/browse/JDK-8187586
>>>
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10] Review Request 8187367: Numerous swing display problems with scaled displays on Windows

Sergey Bylokhov
> I think we should push this fix, although there are concerns we can't
> immediately demonstrate
> that Math.ceil may be wrong in some theoretical case.

+1

> Also Sergey, please add a comment in the bug report about the
> alternative fix you mentioned
> that was discussed previously so that can be re-visited if we
> subsequently find problems as a result of this fix.

done.

>
> -phil.
>
> On 09/19/2017 07:58 AM, Semyon Sadetsky wrote:
>> On 09/18/2017 12:01 PM, Sergey Bylokhov wrote:
>>> Hi, Semyon.
>>> Is it possible to write a test case for this issue? It will be
>>> helpful to understand the bug and a fix.
>>
>> Writing the test is hard because those inner interfaces are  too deep
>> inside. You can use SwingSet2 demo to see the described artifacts at
>> fractional scales before the fix.
>>
>>>
>>> On 9/18/17 09:36, Semyon Sadetsky wrote:
>>>> Hello,
>>>>
>>>> Please review fix for JDK10 (in Swing and Java2D):
>>>>
>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8187367
>>>>
>>>> webrev: http://cr.openjdk.java.net/~ssadetsky/8187367/webrev.00/
>>>>
>>>> Swing apps  may have artifacts on HiDPI screens with fractional
>>>> scales. There are several issues which may cause various artifacts
>>>> but the current fix only eliminates one type of artifacts the
>>>> vertical and horizontal lines on painted surfaces (other issues are
>>>> addressed by [1] and [2]). This issue was introduced after 8073320
>>>> and then incorrectly fixed in 8163193.
>>>>
>>>> The root cause is the painter pattern is drawn on a wrongly sized
>>>> and scaled image in case the image is an off-screen volatile image.
>>>> The painter doesn't take into account the volatile image inner scale
>>>> transformation which is not an identity in case of HiDPI , so the
>>>> resulting image is drawn on of off-screen surface that in the scale
>>>> times bigger than it is actually necessary. Since such images are
>>>> cached this was waste of RAM. Also, the bounds sent to the painter
>>>> class don't take into account the transformation rounding error the
>>>> latter caused artifacts on the drawing edges.
>>>>
>>>> --Semyon
>>>>
>>>> [1] https://bugs.openjdk.java.net/browse/JDK-8187585
>>>>
>>>> [2] https://bugs.openjdk.java.net/browse/JDK-8187586
>>>>
>>>
>>>
>>
>


--
Best regards, Sergey.