jdk/src/macosx/classes/sun/lwawt/macosx/CImage.java
changeset 23257 5aff11b9c9aa
parent 12808 20329ff2140c
child 23328 4c53a6ebc779
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CImage.java	Thu Jan 09 18:04:31 2014 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CImage.java	Thu Jan 09 18:41:00 2014 +0400
@@ -31,6 +31,7 @@
 
 import java.util.Arrays;
 import java.util.List;
+import sun.awt.image.MultiResolutionImage;
 
 import sun.awt.image.SunWritableRaster;
 
@@ -44,6 +45,7 @@
     private static native void nativeCopyNSImageIntoArray(long image, int[] buffer, int w, int h);
     private static native Dimension2D nativeGetNSImageSize(long image);
     private static native void nativeSetNSImageSize(long image, double w, double h);
+    private static native void nativeResizeNSImageRepresentations(long image, double w, double h);
 
     static Creator creator = new Creator();
     static Creator getCreator() {
@@ -145,6 +147,12 @@
 
         // This is used to create a CImage from a Image
         public CImage createFromImage(final Image image) {
+            if (image instanceof MultiResolutionImage) {
+                List<Image> resolutionVariants
+                        = ((MultiResolutionImage) image).getResolutionVariants();
+                return createFromImages(resolutionVariants);
+            }
+
             int[] buffer = imageToArray(image, true);
             if (buffer == null) {
                 return null;
@@ -223,4 +231,8 @@
         if (ptr != 0) nativeSetNSImageSize(ptr, w, h);
         return this;
     }
+
+    void resizeRepresentations(double w, double h) {
+        if (ptr != 0) nativeResizeNSImageRepresentations(ptr, w, h);
+    }
 }