JRE-1028 fwport(9): JRE-1008 Do not use LCD shader on macOS 10.14+ in font rendering

Disable LCD text shader on macOS 10.14+ if LCD rendering is not explicitly specified

(cherry picked from commit dffea9d701)
(cherry picked from commit 1628d6120e)
This commit is contained in:
Alexey Ushakov
2018-11-06 20:40:39 +03:00
committed by jbrbot
parent 2f54488b13
commit 7f28193a31
2 changed files with 28 additions and 0 deletions

View File

@@ -53,3 +53,13 @@ extern jint* gButtonDownMasks;
/** Macro to cast a jlong to an Objective-C object (id). Casts to long on 32-bit systems to quiesce the compiler. */
#define OBJC(jl) ((id)jlong_to_ptr(jl))
#ifndef kCFCoreFoundationVersionNumber10_13_Max
#define kCFCoreFoundationVersionNumber10_13_Max 1499
#endif
#ifndef IS_OSX_GT10_13
#define IS_OSX_GT10_13 (floor(kCFCoreFoundationVersionNumber) > \
kCFCoreFoundationVersionNumber10_13_Max)
#endif

View File

@@ -225,6 +225,24 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo
jint caps = CAPS_EMPTY;
OGLContext_GetExtensionInfo(env, &caps);
Boolean status = false;
Boolean fontSmoothingDisabled =
CFPreferencesGetAppBooleanValue(
CFSTR("CGFontRenderingFontSmoothingDisabled"),
kCFPreferencesCurrentApplication, &status);
if (status) {
if (fontSmoothingDisabled) {
J2dRlsTraceLn(J2D_TRACE_INFO,
"LCD_SHADER: disabled via macOS settings");
caps &= ~CAPS_EXT_LCD_SHADER;
}
} else if (IS_OSX_GT10_13) {
J2dRlsTraceLn(J2D_TRACE_INFO,
"LCD_SHADER: disabled on macOS 10.14+ by default");
caps &= ~CAPS_EXT_LCD_SHADER;
}
GLint value = 0;
[sharedPixelFormat
getValues: &value