From 0fcc40f73f7b6cf079f4211b7bab6c91c2bc977e Mon Sep 17 00:00:00 2001 From: Nikita Nemkin Date: Tue, 17 Apr 2018 17:59:21 +0500 Subject: Bug 184951 - [Win32] Tree/Table checkboxes render jagged at a high DPI DrawThemeBackground stretches the checkbox bitmap to fill the provided rectangle. To avoid stretching artifacts, limit the rectangle to actual checkbox bitmap size. This change also supersedes the fix for bug 489828. Change-Id: Ib227b874716b7858dc52596c5103ceb598e68cbb Signed-off-by: Nikita Nemkin --- .../Eclipse SWT PI/win32/library/os.c | 26 ++++++++++++++++++++++ .../Eclipse SWT PI/win32/library/os_stats.c | 1 + .../Eclipse SWT PI/win32/library/os_stats.h | 1 + .../win32/org/eclipse/swt/internal/win32/OS.java | 7 ++++++ 4 files changed, 35 insertions(+) (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/win32') diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c index 6252d862d8..978d8e67f3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c @@ -4963,6 +4963,32 @@ fail: } #endif +#ifndef NO_GetThemePartSize +JNIEXPORT jint JNICALL OS_NATIVE(GetThemePartSize) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jint arg3, jobject arg4, jint arg5, jobject arg6) +{ + RECT _arg4, *lparg4=NULL; + SIZE _arg6, *lparg6=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, GetThemePartSize_FUNC); + if (arg4) if ((lparg4 = getRECTFields(env, arg4, &_arg4)) == NULL) goto fail; + if (arg6) if ((lparg6 = &_arg6) == NULL) goto fail; +/* + rc = (jint)GetThemePartSize(arg0, arg1, arg2, arg3, lparg4, arg5, lparg6); +*/ + { + OS_LOAD_FUNCTION(fp, GetThemePartSize) + if (fp) { + rc = (jint)((jint (CALLING_CONVENTION*)(jintLong, jintLong, jint, jint, RECT *, jint, SIZE *))fp)(arg0, arg1, arg2, arg3, lparg4, arg5, lparg6); + } + } +fail: + if (arg6 && lparg6) setSIZEFields(env, arg6, lparg6); + OS_NATIVE_EXIT(env, that, GetThemePartSize_FUNC); + return rc; +} +#endif + #ifndef NO_GetThemeTextExtent JNIEXPORT jint JNICALL OS_NATIVE(GetThemeTextExtent) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jint arg3, jcharArray arg4, jint arg5, jint arg6, jobject arg7, jobject arg8) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c index b462daa83c..94d41f5ac9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c @@ -390,6 +390,7 @@ char * OS_nativeFunctionNames[] = { "GetTextExtentPoint32W", "GetTextMetricsA", "GetTextMetricsW", + "GetThemePartSize", "GetThemeTextExtent", "GetTouchInputInfo", "GetUpdateRect", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h index bbff40fbb1..200c80d163 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h @@ -400,6 +400,7 @@ typedef enum { GetTextExtentPoint32W_FUNC, GetTextMetricsA_FUNC, GetTextMetricsW_FUNC, + GetThemePartSize_FUNC, GetThemeTextExtent_FUNC, GetTouchInputInfo_FUNC, GetUpdateRect_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java index e2de419575..f6cd0e8719 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java @@ -1588,6 +1588,7 @@ public class OS extends C { public static final int TREIS_NORMAL = 1; public static final int TREIS_SELECTED = 3; public static final int TREIS_SELECTEDNOTFOCUS = 5; + public static final int TS_TRUE = 1; public static final int TTDT_AUTOMATIC = 0; public static final int TTDT_RESHOW = 1; public static final int TTDT_AUTOPOP = 2; @@ -3944,6 +3945,12 @@ public static final native int GetMessageTime (); * @param hrgn cast=(HRGN) */ public static final native int GetMetaRgn (long /*int*/ hdc, long /*int*/ hrgn); +/** + * @method flags=dynamic + * @param prc flags=no_out + * @param psz flags=no_in + */ +public static final native int GetThemePartSize(long /*int*/ hTheme, long /*int*/ hdc, int iPartId, int iStateId, RECT prc, int eSize, SIZE psz); /** @method flags=dynamic */ public static final native int GetThemeTextExtent (long /*int*/ hTheme, long /*int*/ hdc, int iPartId, int iStateId, char[] pszText, int iCharCount, int dwTextFlags, RECT pBoundingRect, RECT pExtentRect); /** -- cgit v1.2.3