--- old/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c 2017-02-16 11:02:47.445133000 +0530 +++ new/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c 2017-02-16 11:02:47.172997000 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -276,7 +276,6 @@ jint jy, jint jwidth, jint jheight, - jint scale, jintArray pixelArray, jboolean useGtk) { XImage *image; @@ -298,11 +297,6 @@ AWT_LOCK(); - jint sx = jx * scale; - jint sy = jy * scale; - jint swidth = jwidth * scale; - jint sheight = jheight * scale; - rootWindow = XRootWindow(awt_display, adata->awt_visInfo.screen); if (!useGtk) { @@ -314,10 +308,10 @@ } if (!XGetWindowAttributes(awt_display, rootWindow, &attr) - || sx + swidth <= attr.x - || attr.x + attr.width <= sx - || sy + sheight <= attr.y - || attr.y + attr.height <= sy) { + || jx + jwidth <= attr.x + || attr.x + attr.width <= jx + || jy + jheight <= attr.y + || attr.y + attr.height <= jy) { AWT_UNLOCK(); return; // Does not intersect with root window @@ -326,26 +320,25 @@ gboolean gtk_failed = TRUE; jint _x, _y; - jint x = MAX(sx, attr.x); - jint y = MAX(sy, attr.y); - jint width = MIN(sx + swidth, attr.x + attr.width) - x; - jint height = MIN(sy + sheight, attr.y + attr.height) - y; - + jint x = MAX(jx, attr.x); + jint y = MAX(jy, attr.y); + jint width = MIN(jx + jwidth, attr.x + attr.width) - x; + jint height = MIN(jy + jheight, attr.y + attr.height) - y; - int dx = attr.x > sx ? attr.x - sx : 0; - int dy = attr.y > sy ? attr.y - sy : 0; + int dx = attr.x > jx ? attr.x - jx : 0; + int dy = attr.y > jy ? attr.y - jy : 0; int index; if (useGtk) { gtk->gdk_threads_enter(); gtk_failed = gtk->get_drawable_data(env, pixelArray, x, y, width, - height, jwidth, dx, dy, scale); + height, jwidth, dx, dy, 1); gtk->gdk_threads_leave(); } if (gtk_failed) { - image = getWindowImage(awt_display, rootWindow, sx, sy, swidth, sheight); + image = getWindowImage(awt_display, rootWindow, x, y, width, height); ary = (*env)->GetPrimitiveArrayCritical(env, pixelArray, NULL); @@ -355,15 +348,10 @@ return; } - dx /= scale; - dy /= scale; - width /= scale; - height /= scale; - /* convert to Java ARGB pixels */ for (_y = 0; _y < height; _y++) { for (_x = 0; _x < width; _x++) { - jint pixel = (jint) XGetPixel(image, _x * scale, _y * scale); + jint pixel = (jint) XGetPixel(image, _x, _y); /* Note ignore upper * 32-bits on 64-bit * OSes.