jdk/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m
changeset 41776 71e2575dd727
parent 36907 c3d8383e3efb
child 46874 13b399635568
--- a/jdk/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m	Wed Oct 05 18:52:06 2016 +0400
+++ b/jdk/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m	Thu Oct 06 14:31:12 2016 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,10 @@
 #include <sizecalc.h>
 #import "ThreadUtilities.h"
 
+NSString* findScaledImageName(NSString *fileName,
+                              NSUInteger dotIndex,
+                              NSString *strToAppend);
+
 static NSScreen* SplashNSScreen()
 {
     return [[NSScreen screens] objectAtIndex: 0];
@@ -134,8 +138,8 @@
 }
 
 jboolean SplashGetScaledImageName(const char* jar, const char* file,
-                                    float *scaleFactor, char *scaledFile,
-                                    const size_t scaledImageLength) {
+                                  float *scaleFactor, char *scaledFile,
+                                  const size_t scaledImageLength) {
     *scaleFactor = 1;
 
     if(isSWTRunning()){
@@ -158,18 +162,14 @@
                                         options:NSBackwardsSearch];
         NSUInteger dotIndex = range.location;
         NSString *fileName2x = nil;
-        
-        if (dotIndex == NSNotFound) {
-            fileName2x = [fileName stringByAppendingString: @"@2x"];
-        } else {
-            fileName2x = [fileName substringToIndex: dotIndex];
-            fileName2x = [fileName2x stringByAppendingString: @"@2x"];
-            fileName2x = [fileName2x stringByAppendingString:
-                          [fileName substringFromIndex: dotIndex]];
+
+        fileName2x = findScaledImageName(fileName, dotIndex, @"@2x");
+        if(![[NSFileManager defaultManager]
+                fileExistsAtPath: fileName2x]) {
+            fileName2x = findScaledImageName(fileName, dotIndex, @"@200pct");
         }
-        
-        if ((fileName2x != nil) && (jar || [[NSFileManager defaultManager]
-                    fileExistsAtPath: fileName2x])){
+        if (jar || [[NSFileManager defaultManager]
+                fileExistsAtPath: fileName2x]){
             if (strlen([fileName2x UTF8String]) > scaledImageLength) {
                 [pool drain];
                 return JNI_FALSE;
@@ -458,3 +458,16 @@
     sendctl(splash, SPLASHCTL_RECONFIGURE);
 }
 
+NSString* findScaledImageName(NSString *fileName, NSUInteger dotIndex, NSString *strToAppend) {
+    NSString *fileName2x = nil;
+    if (dotIndex == NSNotFound) {
+        fileName2x = [fileName stringByAppendingString: strToAppend];
+    } else {
+        fileName2x = [fileName substringToIndex: dotIndex];
+        fileName2x = [fileName2x stringByAppendingString: strToAppend];
+        fileName2x = [fileName2x stringByAppendingString:
+                      [fileName substringFromIndex: dotIndex]];
+    }
+    return fileName2x;
+}
+