changeset 10475:5334c651c7ba

7002846: Fix for 6989505 may be incomplete Reviewed-by: anthony, art Contributed-by: Andrei Eremeev <andrei.eremeev@oracle.com>
author yan
date Fri, 18 Oct 2013 15:15:24 +0400
parents 3c2d4569a6a3
children 84ae644933b6
files src/windows/classes/sun/awt/windows/WRobotPeer.java src/windows/native/sun/windows/awt_Robot.cpp src/windows/native/sun/windows/awt_Robot.h
diffstat 3 files changed, 2 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/classes/sun/awt/windows/WRobotPeer.java	Thu Oct 17 21:22:05 2013 +0400
+++ b/src/windows/classes/sun/awt/windows/WRobotPeer.java	Fri Oct 18 15:15:24 2013 +0400
@@ -56,9 +56,9 @@
     public native void keyRelease( int keycode );
 
     public int getRGBPixel(int x, int y) {
-        return getRGBPixelImpl(x, y);
+         // See 7002846: that's ineffective, but works correctly with non-opaque windows
+        return getRGBPixels(new Rectangle(x, y, 1, 1))[0];
     }
-    public native int getRGBPixelImpl(int x, int y);
 
     public int [] getRGBPixels(Rectangle bounds) {
         int pixelArray[] = new int[bounds.width*bounds.height];
--- a/src/windows/native/sun/windows/awt_Robot.cpp	Thu Oct 17 21:22:05 2013 +0400
+++ b/src/windows/native/sun/windows/awt_Robot.cpp	Fri Oct 18 15:15:24 2013 +0400
@@ -192,15 +192,6 @@
     return value;
 }
 
-jint AwtRobot::GetRGBPixel( jint x, jint y)
-{
-    HDC hdc = ::CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
-    COLORREF ref = ::GetPixel( hdc, x, y );
-    ::DeleteDC(hdc);
-    jint value = WinToJavaPixel(GetRValue(ref), GetGValue(ref), GetBValue(ref));
-    return value;
-}
-
 void AwtRobot::GetRGBPixels(jint x, jint y, jint width, jint height, jintArray pixelArray)
 {
     DASSERT(width > 0 && height > 0);
@@ -403,15 +394,6 @@
     CATCH_BAD_ALLOC;
 }
 
-JNIEXPORT jint JNICALL Java_sun_awt_windows_WRobotPeer_getRGBPixelImpl(
-    JNIEnv * env, jobject self, jint x, jint y)
-{
-    TRY;
-
-    return AwtRobot::GetRobot(self)->GetRGBPixel(x, y);
-
-    CATCH_BAD_ALLOC_RET(0);
-}
 JNIEXPORT void JNICALL Java_sun_awt_windows_WRobotPeer_getRGBPixels(
     JNIEnv *env, jobject self, jint x, jint y, jint width, jint height, jintArray pixelArray)
 {
--- a/src/windows/native/sun/windows/awt_Robot.h	Thu Oct 17 21:22:05 2013 +0400
+++ b/src/windows/native/sun/windows/awt_Robot.h	Fri Oct 18 15:15:24 2013 +0400
@@ -44,7 +44,6 @@
         void MouseWheel(jint wheelAmt);
         jint getNumberOfButtons();
 
-        jint GetRGBPixel( jint x, jint y);
         void GetRGBPixels(jint x, jint y, jint width, jint height, jintArray pixelArray);
 
         void KeyPress( jint key );