--- old/src/java.desktop/macosx/classes/sun/lwawt/macosx/CRobot.java 2017-02-09 15:00:25.073640001 +0530 +++ new/src/java.desktop/macosx/classes/sun/lwawt/macosx/CRobot.java 2017-02-09 15:00:24.861640001 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -174,7 +174,8 @@ @Override public int getRGBPixel(int x, int y) { int c[] = new int[1]; - getScreenPixels(new Rectangle(x, y, 1, 1), c); + double scale = fDevice.getScaleFactor(); + getScreenPixels(new Rectangle(x, y, (int) scale, (int) scale), c); return c[0]; } @@ -185,7 +186,7 @@ */ @Override public int [] getRGBPixels(final Rectangle bounds) { - int c[] = new int[bounds.width * bounds.height]; + int c[] = new int[bounds.width * bounds.height]; getScreenPixels(bounds, c); return c; @@ -198,7 +199,8 @@ boolean isMouseMove); private native void keyEvent(int javaKeyCode, boolean keydown); private void getScreenPixels(Rectangle r, int[] pixels){ - nativeGetScreenPixels(r.x, r.y, r.width, r.height, pixels); + double scale = fDevice.getScaleFactor(); + nativeGetScreenPixels(r.x, r.y, r.width, r.height, scale, pixels); } - private native void nativeGetScreenPixels(int x, int y, int width, int height, int[] pixels); + private native void nativeGetScreenPixels(int x, int y, int width, int height, double scale, int[] pixels); }