<AWT Dev> [8] Review request for 8011059 [macosx] Make JDK demos look perfect on retina displays
Alexander Scherbatiy
alexandr.scherbatiy at oracle.com
Wed Oct 23 08:24:05 PDT 2013
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.
>
More information about the macosx-port-dev
mailing list