<AWT Dev> Review request for 8143064 Icons are not properly rendered with Windows L&F on HiDPI display

Alexandr Scherbatiy alexandr.scherbatiy at oracle.com
Fri Jul 8 11:28:36 UTC 2016


On 7/7/2016 9:11 PM, Semyon Sadetsky wrote:
> Caching works. Icon sizes are correct as well.
> Why the check box image doesn't change its size with the scale? Only 
> margins are growing. Is it expected behavior?

  Screenshot [1] shows checkboxes for the native control, java checkbox 
with the fix and java checkbox without the fix. The checkbox icon after 
the fix looks similar to the native checkbox icon.
  Screenshot [2] shows comboboxes. The icon becomes smaller after the 
fix but it has high-resolution and looks similar to the native icon.

   [1] 
http://cr.openjdk.java.net/~alexsch/8143064/screenshots/checkbox-compare-00.png
   [2] 
http://cr.openjdk.java.net/~alexsch/8143064/screenshots/combobox-compare-00.png

   Thanks,
   Alexandr.
>
> --Semyon
>
> On 05.07.2016 16:53, Alexandr Scherbatiy wrote:
>>
>> Could you review the updated fix:
>>   http://cr.openjdk.java.net/~alexsch/8143064/webrev.02
>>
>> - the PainterMultiResolutionCachedImage.getWidth()/getHeight() 
>> methods are overridden to not call the base resolution variant
>> - scale factors are added to the multi-resolution image
>> - component and args are set to the 
>> PainterMultiResolutionCachedImage  before painting
>>
>> On 6/30/2016 11:38 AM, Semyon Sadetsky wrote:
>>> Hi Alexander,
>>>
>>> I have added printout after the line 679 of the XPStyle.java:
>>>
>>> 676 ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
>>> 677 part.getControlName(c), part.getValue(),
>>> 678 State.getValue(part, state),
>>> 679                                        0, 0, w, h, w);
>>>
>>> -->> System.out.println(w + " " + h + " " + part.getControlName(c) + 
>>> " " + part.getValue() + " " + State.getValue(part, state));
>>>
>>> And it prints the same lines constantly when I repeatedly focus the 
>>> test window without resizing it.
>>>
>>> It seems to me that the image caching doesn't work and the image is 
>>> reconstructed each time from the native theme.
>>    SunGraphics2D requests the multi-resolution image size which leads 
>> that the base resolution image is recreated each time.
>>    I fixed it overridden the getWidth()/getHeight() methods.
>>
>>   Thanks,
>>   Alexandr.
>>>
>>> Yet another question: why not use the actual scaling factor for the 
>>> resolution variant instead of fixed 2X?
>>>
>>> --Semyon
>>>
>>>
>>> On 6/29/2016 6:50 PM, Alexandr Scherbatiy wrote:
>>>>
>>>> Hello,
>>>>
>>>> Could you review the updated fix:
>>>>   http://cr.openjdk.java.net/~alexsch/8143064/webrev.01
>>>>
>>>> The MultiResolutionImage image is used for the icons painting.
>>>>
>>>> Thanks,
>>>> Alexandr.
>>>>
>>>> On 11/16/2015 7:07 PM, Sergey Bylokhov wrote:
>>>>> Hi, Alexander.
>>>>>  109         AffineTransform tx = ((Graphics2D) g).getTransform();
>>>>>  110         int sw = tx.isIdentity() ? w : (int) Math.round(w * 
>>>>> tx.getScaleX());
>>>>>  111         int sh = tx.isIdentity() ? h : (int) Math.round(h * 
>>>>> tx.getScaleY());
>>>>>
>>>>> I think that it is not necessary that !isIdentity transform return 
>>>>> non-zero value from the getScaleX/Y method. I recall that exactly 
>>>>> the same bug on OSX was fixed via MultiResolutionCachedImage, why 
>>>>> we cannot do the same here?
>>>>>
>>>>> On 16.11.15 17:43, Alexander Scherbatiy wrote:
>>>>>> Could you review the fix:
>>>>>>    bug: https://bugs.openjdk.java.net/browse/JDK-8143064
>>>>>>    webrev: http://cr.openjdk.java.net/~alexsch/8143064/webrev.00
>>>>>>
>>>>>>    Icon image sizes are scaled in sun.swing.CachedPainter.
>>>>>>
>>>>>>    Thanks,
>>>>>>    Alexandr.
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>



More information about the awt-dev mailing list