<Swing Dev> [9] Review request for 8162856 JSlider thumb is twice smaller on HiDPI display

Alexandr Scherbatiy alexandr.scherbatiy at oracle.com
Mon Aug 8 08:01:52 UTC 2016


Could you review the updated fix:
   http://cr.openjdk.java.net/~alexsch/8162856/webrev.01/

  - the image graphics is scaled before passed it to 
CachedPainter.paintToImage() method
  - scale factors are removed from the PainterMultiResolutionCachedImage 
class

On 8/3/2016 3:26 PM, Sergey Bylokhov wrote:
> On 02.08.16 18:01, Sergey Bylokhov wrote:
>> Hi, Alex.
>>  - Is it necessary to restore tha scale to the previous value?
>>  - It seems that getIconWidth/getIconHeight can be used instead of 15
>> and 16?
>>  - Should we update other implementations of paintToImage() in other
>> classes?
   There is an issue with the Metal L&F gradient which is not fixed by 
scaling the graphics.
   It requires additional investigation. I have filled a new issue on it:
     JDK-8163193 Metal L&F gradient is lighter on HiDPI display after 
the fix JDK-8143064
>
> And related question: why the Graphics was not scaled when it was created.
   The paintToImage() method should properly draw an image into the 
provided width and height.
   That is what the MultiResolutionImage.getResolutionVariant(width, 
height) method does. It just requests to draw the image into the scaled 
width and height.

  Using the scaled graphics requires the following steps:
   - create an image with scaled size
   - scale the graphics
   - call paintToImage() with base image size

This does not work for Windows L&F because it requests the native system 
to draw the image into provided sizes.
I updated the Window L&F to use the real image size instead of the given 
width and height.

>
>>
>> On 02.08.16 13:46, Alexandr Scherbatiy wrote:
>>>
>>> Hello,
>>>
>>> Could you review the fix:
>>>   bug: https://bugs.openjdk.java.net/browse/JDK-8162856
>>>   webrev: http://cr.openjdk.java.net/~alexsch/8162856/webrev.00
>>>
>>>   This is a regression from the fix: JDK-8143064 Icons are not properly
>>> rendered with Windows L&F on HiDPI display
>>> MetalIconFactory.OceanVerticalSliderThumbIcon/OceanHorizontalSliderThumbIcon.paintToImage(...) 
>>>
>>>
>>> methods do not take the provided image size into account.
>>>   The fix sets graphics scale when icon sizes are different from 
>>> default.
>>>
>>>  Thanks,
>>>  Alexandr.
>>>
>>>
>>
>>
>
>




More information about the swing-dev mailing list