[OpenJDK 2D-Dev] <AWT Dev> [8] Review request for 8011059 [macosx] Make JDK demos look perfect on retina displays

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Oct 29 19:08:30 UTC 2013


Hi, Alexander.
The fix looks fine to me in general. But there is at least one issue. I 
build you fix and test it:
  - Consuming of cpu increased by 500 times Java2Demo on images tab.
  - FPS is dropped from 220(jdk8)/35(jdk7u40) to 15 in guimark2. Note 
that jdk6 has the same FPS(15) on my system.

On 29.10.2013 20:45, Alexander Scherbatiy wrote:
>
>   Could you review the updated fix:
>     http://cr.openjdk.java.net/~alexsch/8011059/webrev.03
>
> On 10/28/2013 2:33 PM, Artem Ananiev wrote:
>> Hi, Alexander,
>>
>> a few comments:
>>
>> 1. SunGraphics2D.java:3076 - should isHiDPIImage() be used here?
>      The isHiDPIImage() method is used to check that the 
> drawHiDPIImage should be called like:
>         if (isHiDPIImage(img)) {
>             return drawHiDPIImage(...);
>         }
>
>> 2. I'm not sure that the proposed getScaledImageName() implementation 
>> in ScalableToolkitImage works perfectly for URLs like this:
>>
>>   http://www.exampmle.com/dir/image
>>
>> In this case it will try to find 2x image here:
>>
>>   http://www.example@2x.com/dir/image
>>
>> which doesn't look correct.
>        Fixed. Only path part of a URL is converted to path2x.
>
>> 3. RenderingHints spec references Retina or non-Retina displays, 
>> which should be removed.
>        Fixed.
>
>     - devScale is used instead of transform parsing in the 
> drawHiDPIImage() method just to not have performance regression more 
> than 2 times on HiDPI displays
>     - LWCToolkit.ScalableToolkitImage is made public for the fix 
> 8024926 [macosx] AquaIcon HiDPI support.
>
>     Thanks,
>     Alexandr.
>
>>
>> Thanks,
>>
>> Artem
>>
>> On 10/25/2013 5:18 PM, Alexander Scherbatiy wrote:
>>>
>>>    Could you review the updated fix:
>>>        http://cr.openjdk.java.net/~alexsch/8011059/webrev.02/
>>>
>>>    - Scaled image width and height are transformed according to the
>>> AffineTransform type.
>>>    - ToolkitImage subclass is used to hold @2x image instance.
>>>
>>>   Thanks,
>>>   Alexandr.
>>>
>>> On 10/23/2013 7:24 PM, Alexander Scherbatiy wrote:
>>>>
>>>>   Could you review the updated fix:
>>>>      http://cr.openjdk.java.net/~alexsch/8011059/webrev.01/
>>>>
>>>>   The JCK failures has been resolved:
>>>>     - Some tests tries to draw an image with Integer.MAX_VALUE width
>>>> or height. Passing large values to image.getScaledImage(width, height,
>>>> hints).
>>>>        leads that an Image filter is not able to create necessary
>>>> arrays.  The fix uses the original image if width or height are equal
>>>> to Integer.MAX_VALUE.
>>>>     - Using Image.SCALE_DEFAULT hint for the getScaledImage(width,
>>>> height, hints) method to get the high resolution image interferes with
>>>>        JCK tests that expect that the scaled image by certain
>>>> algorithm is returned. This is fixed by invoking the
>>>> super.getScaledImage(width, height, hints)
>>>>        method in ToolkitImage in case if a high resolution image is
>>>> not set.
>>>>
>>>>     Thanks,
>>>>     Alexandr.
>>>>
>>>>
>>>>
>>>> On 10/22/2013 1:31 PM, Alexander Scherbatiy wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> Could you review the fix:
>>>>>
>>>>>   bug: https://bugs.openjdk.java.net/browse/JDK-8011059
>>>>>   webrev: http://cr.openjdk.java.net/~alexsch/8011059/webrev.00
>>>>>
>>>>>   The IMAGE_SCALING rendering hint is added to the RenderingHints 
>>>>> class.
>>>>>   Enabling the image scaling rendering hint forces the SunGraphics2D
>>>>> to use getScaledInstance(width, height, hints) method
>>>>>   from Image class with SCALE_DEFAULT hint.
>>>>>
>>>>>   By default the image scaling rendering hint is enabled on HiDPI
>>>>> display and disabled for standard displays.
>>>>>
>>>>>   User can override the getScaledInstance(width, height, hints)
>>>>> method and return necessary high resolution image
>>>>>   according to the given image width and height.
>>>>>
>>>>>   For example:
>>>>>   ---------------------
>>>>>         final Image highResolutionImage =
>>>>>                 new BufferedImage(2 * WIDTH, 2 * HEIGHT,
>>>>> BufferedImage.TYPE_INT_RGB);
>>>>>         Image image = new BufferedImage(WIDTH, HEIGHT,
>>>>> BufferedImage.TYPE_INT_RGB) {
>>>>>
>>>>>             @Override
>>>>>             public Image getScaledInstance(int width, int height, int
>>>>> hints) {
>>>>>                 if ((hints & Image.SCALE_DEFAULT) != 0) {
>>>>>                     return (width <= WIDTH && height <= HEIGHT)
>>>>>                             ? this : highResolutionImage;
>>>>>                 }
>>>>>                 return super.getScaledInstance(width, height, hints);
>>>>>             }
>>>>>         };
>>>>>   ---------------------
>>>>>
>>>>>   The LWCToolkit and ToolkitImage classes are patched to
>>>>> automatically get provided image at 2x.ext images on MacOSX.
>>>>>
>>>>>   There are no significant changes in the Java2D demo to make it look
>>>>> perfect on Retina displays.
>>>>>   It needs only to put necessary images with the @2x postfix and they
>>>>> will be automatically drawn.
>>>>>
>>>>> Thanks,
>>>>> Alexandr.
>>>>>
>>>>
>>>
>


-- 
Best regards, Sergey.




More information about the 2d-dev mailing list