7002846: Fix for 6989505 may be incomplete

Reviewed-by: anthony, art
This commit is contained in:
Andrei Eremeev 2013-10-18 15:15:24 +04:00 committed by Yuri Nesterenko
parent 44383570a1
commit 26158306cd
3 changed files with 2 additions and 21 deletions
jdk/src/windows
classes/sun/awt/windows
native/sun/windows

@ -56,9 +56,9 @@ class WRobotPeer extends WObjectPeer implements RobotPeer
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];

@ -192,15 +192,6 @@ inline jint AwtRobot::WinToJavaPixel(USHORT r, USHORT g, USHORT b)
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 @@ JNIEXPORT void JNICALL Java_sun_awt_windows_WRobotPeer_mouseWheel(
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)
{

@ -44,7 +44,6 @@ class AwtRobot : public AwtObject
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 );