<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
Tue Jul 5 13:53:38 UTC 2016


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