diff options
author | Anton Tarasov <anton.tarasov@jetbrains.com> | 2018-03-30 03:13:08 +0300 |
---|---|---|
committer | Anton Tarasov <anton.tarasov@jetbrains.com> | 2018-03-30 03:14:06 +0300 |
commit | 62000130d86e5831d81cfb24659386c6930f84cf (patch) | |
tree | 925a3e79b96d69a3e8fc19d44d84129990ee9c6c | |
parent | 74ba08ba1e81fd7cc9a7f92181e05e09699a2c3d (diff) | |
download | jdk8u_jdk-jb8u152-b1214.tar.gz |
JRE-711 Horizontal grey lines appear in every window in IntelliJ Ideajb8u152-b1214
-rw-r--r-- | src/windows/native/sun/windows/awt_Component.cpp | 24 | ||||
-rw-r--r-- | src/windows/native/sun/windows/awt_Component.h | 2 |
2 files changed, 20 insertions, 6 deletions
diff --git a/src/windows/native/sun/windows/awt_Component.cpp b/src/windows/native/sun/windows/awt_Component.cpp index 7b64aedd7f..588ade8e7b 100644 --- a/src/windows/native/sun/windows/awt_Component.cpp +++ b/src/windows/native/sun/windows/awt_Component.cpp @@ -52,6 +52,7 @@ #include <Region.h> #include <jawt.h> +#include <math.h> #include <java_awt_Toolkit.h> #include <java_awt_FontMetrics.h> @@ -2290,8 +2291,8 @@ void AwtComponent::PaintUpdateRgn(const RECT *insets) */ RECT* r = (RECT*)(buffer + rgndata->rdh.dwSize); RECT* un[2] = {0, 0}; - DWORD i; - for (i = 0; i < rgndata->rdh.nCount; i++, r++) { + DWORD i; + for (i = 0; i < rgndata->rdh.nCount; i++, r++) { int width = r->right-r->left; int height = r->bottom-r->top; if (width > 0 && height > 0) { @@ -2305,11 +2306,12 @@ void AwtComponent::PaintUpdateRgn(const RECT *insets) } for(i = 0; i < 2; i++) { if (un[i] != 0) { + ScaleDownRect(*un[i]); DoCallback("handleExpose", "(IIII)V", - ScaleDownX(un[i]->left), - ScaleDownY(un[i]->top), - ScaleDownX(un[i]->right - un[i]->left), - ScaleDownY(un[i]->bottom - un[i]->top)); + un[i]->left, + un[i]->top, + un[i]->right - un[i]->left, + un[i]->bottom - un[i]->top); } } delete [] buffer; @@ -4798,6 +4800,16 @@ int AwtComponent::ScaleDownDY(int y) { return device == NULL ? y : device->ScaleDownDY(y); } +void AwtComponent::ScaleDownRect(RECT& r) { + int screen = AwtWin32GraphicsDevice::DeviceIndexForWindow(GetHWnd()); + Devices::InstanceAccess devices; + AwtWin32GraphicsDevice* device = devices->GetDevice(screen); + if (device == NULL) return; + float sx = device->GetScaleX(); + float sy = device->GetScaleY(); + ::SetRect(&r, floor(r.left / sx), floor(r.top / sy), ceil(r.right / sx), ceil(r.bottom / sy)); +} + jintArray AwtComponent::CreatePrintedPixels(SIZE &loc, SIZE &size, int alpha) { JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); diff --git a/src/windows/native/sun/windows/awt_Component.h b/src/windows/native/sun/windows/awt_Component.h index 85e6faaf82..039b3d8d17 100644 --- a/src/windows/native/sun/windows/awt_Component.h +++ b/src/windows/native/sun/windows/awt_Component.h @@ -728,6 +728,8 @@ public: int ScaleUpDY(int y); int ScaleDownDX(int x); int ScaleDownDY(int y); + void ScaleDownRect(RECT& r); + //void ScaleDownDRect(RECT& r); protected: static AwtComponent* GetComponentImpl(HWND hWnd); |