<Swing Dev> [9] Review request for 8176883 Enable antialiasing for Metal L&F icons on HiDPI display

Alexandr Scherbatiy alexandr.scherbatiy at oracle.com
Thu Mar 16 18:46:26 UTC 2017


On 3/16/2017 9:16 PM, Phil Race wrote:
> Hi,
>
> What I was referring to regarding "draws using G2D calls" was that 
> paintIcon(..) looks like this
>
>
> 1335 Object aaHint = getAndSetAntialisingHintForScaledGraphics(g);
> 1336
> 1337             if (MetalLookAndFeel.usingOcean()) {
> 1338                 paintOceanIcon(c, g, x, y);
> 1339 setAntialiasingHintForScaledGraphics(g, aaHint);
> 1340                 return;
> 1341             }
> ...
> ..
> 1386                 g.setColor(dotColor);
> 1387                 g.fillOval(2, 2, 7, 7);          << Why does Graphics.fillOval (etc) need to be A-Aed here ?
    The graphics has floating point scale on HiDPI display with 150% scale.
    The given oval is the center circle in the radio button. It is not 
painted smooth with the UI scale 1.5.
    I prepared the  screenshot with a radio button (top is before the 
fix and bottom is after the fix with AA rendering hint enabled)
http://cr.openjdk.java.net/~alexsch/8176883/screenshots/00/metal-radio-button-150pcs.png

   Thanks,
   Alexandr.
> 1388             }
> 1389
> 1390             g.translate(-x, -y);
> 1391 setAntialiasingHintForScaledGraphics(g, aaHint);
> 1392         }
>
> -phil.
>
> On 03/16/2017 11:04 AM, Alexandr Scherbatiy wrote:
>>
>>   Hello,
>>
>>   Could you review the updated fix:
>> http://cr.openjdk.java.net/~alexsch/8176883/webrev.01
>>
>>   - The SwingUtilities2.getAndSetAntialisingHintForScaledGraphics() 
>> sets the AA rendering hint only for local display.
>>   - The SwingUtilities2.setAntialiasingHintForScaledGraphics() method 
>> javadoc is updated to mention that the null AA rendering hint means 
>> that the passed graphics is not instance of Graphics2D.
>>
>> On 3/16/2017 7:47 PM, Phil Race wrote:
>>>
>>> Hi,
>>>
>>> It looks to me as if this applies AA rendering even when you
>>> are drawing using G2D calls. Why ?
>>   I updated the methods javadoc. The passed aaHint to the method 
>> setAntialiasingHintForScaledGraphics() must be null for the non 
>> Graphics2D.
>>>
>>> Also this clearly only helps Metal. Is that because only Metal has 
>>> such problems ?
>>> I would doubt that.
>>>
>>> FWIW Motif L&F probably should not get this treatment.
>>    The The Windows L&F already uses the AA hints by the fix JDK-8165594.
>>    The GTK L&F uses only integer UI scale factor.
>>> Also if the desktop is "remote" we should avoid AA. I believe we do 
>>> that
>>> for text with Metal so there should be example of how to detect that
>>> somewhere.
>>   I updated the fix.
>>
>>   Thanks,
>>   Alexandr.
>>>
>>> -phil.
>>>
>>> On 03/16/2017 09:03 AM, Alexandr Scherbatiy wrote:
>>>>
>>>> Hello,
>>>>
>>>> Could you review the fix:
>>>>   bug: https://bugs.openjdk.java.net/browse/JDK-8176883
>>>>   webrev: http://cr.openjdk.java.net/~alexsch/8176883/webrev.00
>>>>
>>>>   Metal RadioButton and RadioButtonMenuItem icons are not drawn 
>>>> smoothly on HiDPI displays especially with floating point scales 
>>>> like 1.25 and 1.5.
>>>>   The fix enables the antialiasing rendering hint for the radio 
>>>> button and radio button menu item if the passed graphics is scaled.
>>>>
>>>>   The [1] folder contains screenshots how icons are drawn before 
>>>> the fix (on the left side) and after the fix (on the right side).
>>>>
>>>>   [1] http://cr.openjdk.java.net/~alexsch/8176883/screenshots/00
>>>>
>>>> Thanks,
>>>> Alexandr.
>>>>
>>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20170316/54b7c756/attachment.html>


More information about the swing-dev mailing list