--- old/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m 2014-06-17 14:39:34.148708300 +0400 +++ new/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m 2014-06-17 14:39:33.411114700 +0400 @@ -125,6 +125,36 @@ return buf; } +char* SplashGetScaledImageName(const char* jar, const char* file, + float *scaleFactor) { + NSString *fileName = [[[NSString alloc] initWithUTF8String: file] + autorelease]; + NSUInteger length = [fileName length]; + *scaleFactor = 1; + float screenScaleFactor = [[NSScreen mainScreen] backingScaleFactor]; + + if (1 < screenScaleFactor) { + NSRange range = [fileName rangeOfString: @"." + options:NSBackwardsSearch]; + int index = range.location; + + if (index != NSNotFound && index != 0 && index != length-1) { + NSString *fileName2x = [fileName substringToIndex: index]; + fileName2x = [fileName2x stringByAppendingString: @"@2x"]; + fileName2x = [fileName2x stringByAppendingString: + [fileName substringFromIndex: index]]; + + if (!jar && ![[NSFileManager defaultManager] + fileExistsAtPath: fileName2x]){ + return nil; + } + + *scaleFactor = 2; + return strdup([fileName2x UTF8String]); + } + } + return nil; +} void SplashInitPlatform(Splash * splash) { @@ -132,7 +162,7 @@ splash->maskRequired = 0; - + //TODO: the following is too much of a hack but should work in 90% cases. // besides we don't use device-dependant drawing, so probably // that's very fine indeed @@ -225,7 +255,15 @@ [image setBackgroundColor: [NSColor clearColor]]; [image addRepresentation: rep]; - + float scaleFactor = splash->scaleFactor; + if (scaleFactor != 1) { + [image setScalesWhenResized:YES]; + NSSize size = [image size]; + size.width /= scaleFactor; + size.height /= scaleFactor; + [image setSize: size]; + } + NSImageView * view = [[NSImageView alloc] init]; [view setImage: image];