diff --git a/rlawt_mac.m b/rlawt_mac.m index 61ff9c8..40948d2 100644 --- a/rlawt_mac.m +++ b/rlawt_mac.m @@ -29,6 +29,7 @@ #include #include #include +#include @protocol CanSetContentsChanged -(void)setContentsChanged; @@ -110,8 +111,9 @@ static void propsPutInt(CFMutableDictionaryRef props, const CFStringRef key, int static bool rlawtCreateIOSurface(JNIEnv *env, AWTContext *ctx) { CFMutableDictionaryRef props = CFDictionaryCreateMutable(NULL, 4, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CGSize size = ctx->layer.frame.size; - propsPutInt(props, kIOSurfaceHeight, size.height); - propsPutInt(props, kIOSurfaceWidth, size.width); + CGFloat scale = [[NSScreen mainScreen] backingScaleFactor]; + propsPutInt(props, kIOSurfaceHeight, size.height*scale); + propsPutInt(props, kIOSurfaceWidth, size.width*scale); propsPutInt(props, kIOSurfaceBytesPerElement, 4); propsPutInt(props, kIOSurfacePixelFormat, (int)'BGRA'); @@ -128,7 +130,7 @@ static bool rlawtCreateIOSurface(JNIEnv *env, AWTContext *ctx) { CGLError err = CGLTexImageIOSurface2D( ctx->context, target, GL_RGBA, - size.width, size.height, + size.width*scale, size.height*scale, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, buf, 0); @@ -217,7 +219,8 @@ JNIEXPORT void JNICALL Java_net_runelite_rlawt_AWTContext_createGLContext(JNIEnv layer.needsDisplayOnBoundsChange = false; layer.magnificationFilter = kCAFilterNearest; layer.contentsGravity = kCAGravityCenter; - layer.affineTransform = CGAffineTransformMakeScale(1, -1); + CGFloat scale = 1.0/[[NSScreen mainScreen] backingScaleFactor]; + layer.affineTransform = CGAffineTransformMakeScale(scale, -scale); ctx->layer = layer; dspi.layer = layer;