changeset 4680:1551cb104ed3

7124364: [macosx] Robot screen capturing functionality doesn't work Reviewed-by: anthony
author leonidr
date Wed, 25 Jan 2012 17:29:38 +0300
parents bb6ca744cb04
children 28fb85f284a4
files src/macosx/classes/sun/lwawt/macosx/CRobot.java
diffstat 1 files changed, 2 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/macosx/CRobot.java	Wed Jan 25 15:15:53 2012 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/CRobot.java	Wed Jan 25 17:29:38 2012 +0300
@@ -210,31 +210,8 @@
      */
     @Override
     public int [] getRGBPixels(final Rectangle bounds) {
-        Rectangle screenBounds = fDevice.getDefaultConfiguration().getBounds();
-        // screenBounds is in the coordinates of the primary device
-        // but bounds is in the coordinates of fDevice
-        // so we fix screenbounds at 0,0 origin
-        screenBounds.x = screenBounds.y = 0;
-        Rectangle intersection = screenBounds.intersection(bounds);
-
-        int c[] = new int[intersection.width * intersection.height];
-        getScreenPixels(intersection, c);
-
-        if (!intersection.equals(bounds)) {
-            // Since we are returning a smaller array than the code expects,
-            // we have to copy our existing array into an array of the
-            // "correct" size
-            int c2[] = new int[bounds.width * bounds.height];
-            for (int h=0; h<bounds.height; h++) {
-                int boundsRow = h+bounds.y;
-                if (boundsRow>=intersection.y && boundsRow<intersection.height) {
-                    int srcPos = (boundsRow-intersection.y)*intersection.width;
-                    int destPos = (h*bounds.width) + (intersection.x-bounds.x);
-                    System.arraycopy(c, srcPos, c2, destPos, intersection.width);
-                }
-            }
-            c = c2;
-        }
+        int c[] = new int[bounds.width * bounds.height];
+        getScreenPixels(bounds, c);
 
         return c;
     }