JBR-4636 Some JWindow tests failed due to wrong scaling

Take into account custom scale via sun.java2d.uiScale

(cherry picked from commit 5a91de055f)
This commit is contained in:
Alexey Ushakov
2022-07-13 22:09:16 +02:00
committed by Vitaly Provodin
parent 094aefc4db
commit 783e7789cc

View File

@@ -32,6 +32,7 @@
#import "GeomUtilities.h"
#import "ThreadUtilities.h"
#import "JNIUtilities.h"
#import "jni_util.h"
#import "PropertiesUtilities.h"
#import <Carbon/Carbon.h>
@@ -1484,7 +1485,13 @@ static jclass jc_CInputMethod = NULL;
- (void)viewDidChangeBackingProperties {
JNIEnv *env = [ThreadUtilities getJNIEnv];
if (self.window.backingScaleFactor > 0) {
static double debugScale = -2.0;
if (debugScale == -2.0) { // default debugScale value in SGE is -1.0
debugScale = JNU_CallStaticMethodByName(env, NULL, "sun/java2d/SunGraphicsEnvironment",
"getDebugScale", "()D").d;
}
if (self.window.backingScaleFactor > 0 && debugScale < 0) {
self.layer.contentsScale = self.window.backingScaleFactor;
DECLARE_CLASS(jc_CPlatformView, "sun/lwawt/macosx/CPlatformView");
DECLARE_METHOD(deliverChangeBackingProperties, jc_CPlatformView, "deliverChangeBackingProperties", "(F)V");