src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m

Print this page




 114     iconv_close(cd);
 115 
 116     if (rc == (size_t)-1) {
 117         free(buf);
 118         buf = NULL;
 119     } else {
 120         if (size) {
 121             *size = (bufSize-outSize)/2; /* bytes to wchars */
 122         }
 123     }
 124 done:
 125     setlocale(LC_ALL, old_locale);
 126     return buf;
 127 }
 128 
 129 char* SplashGetScaledImageName(const char* jar, const char* file,
 130                                float *scaleFactor) {
 131     NSAutoreleasePool *pool = [NSAutoreleasePool new];
 132     *scaleFactor = 1;
 133     char* scaledFile = nil;
 134     float screenScaleFactor = 1;







 135 
 136     if (screenScaleFactor > 1) {
 137         NSString *fileName = [NSString stringWithUTF8String: file];
 138         NSUInteger length = [fileName length];
 139         NSRange range = [fileName rangeOfString: @"."
 140                                         options:NSBackwardsSearch];
 141         NSUInteger dotIndex = range.location;
 142         NSString *fileName2x = nil;
 143         
 144         if (dotIndex == NSNotFound) {
 145             fileName2x = [fileName stringByAppendingString: @"@2x"];
 146         } else {
 147             fileName2x = [fileName substringToIndex: dotIndex];
 148             fileName2x = [fileName2x stringByAppendingString: @"@2x"];
 149             fileName2x = [fileName2x stringByAppendingString:
 150                           [fileName substringFromIndex: dotIndex]];
 151         }
 152         
 153         if ((fileName2x != nil) && (jar || [[NSFileManager defaultManager]
 154                     fileExistsAtPath: fileName2x])){




 114     iconv_close(cd);
 115 
 116     if (rc == (size_t)-1) {
 117         free(buf);
 118         buf = NULL;
 119     } else {
 120         if (size) {
 121             *size = (bufSize-outSize)/2; /* bytes to wchars */
 122         }
 123     }
 124 done:
 125     setlocale(LC_ALL, old_locale);
 126     return buf;
 127 }
 128 
 129 char* SplashGetScaledImageName(const char* jar, const char* file,
 130                                float *scaleFactor) {
 131     NSAutoreleasePool *pool = [NSAutoreleasePool new];
 132     *scaleFactor = 1;
 133     char* scaledFile = nil;
 134     __block float screenScaleFactor = 1;
 135 
 136     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
 137         // initialize the display environment and connect the program
 138         // to the window and the display servers
 139         [NSApplicationAWT sharedApplication];
 140         screenScaleFactor = [SplashNSScreen() backingScaleFactor];
 141     }];
 142 
 143     if (screenScaleFactor > 1) {
 144         NSString *fileName = [NSString stringWithUTF8String: file];
 145         NSUInteger length = [fileName length];
 146         NSRange range = [fileName rangeOfString: @"."
 147                                         options:NSBackwardsSearch];
 148         NSUInteger dotIndex = range.location;
 149         NSString *fileName2x = nil;
 150         
 151         if (dotIndex == NSNotFound) {
 152             fileName2x = [fileName stringByAppendingString: @"@2x"];
 153         } else {
 154             fileName2x = [fileName substringToIndex: dotIndex];
 155             fileName2x = [fileName2x stringByAppendingString: @"@2x"];
 156             fileName2x = [fileName2x stringByAppendingString:
 157                           [fileName substringFromIndex: dotIndex]];
 158         }
 159         
 160         if ((fileName2x != nil) && (jar || [[NSFileManager defaultManager]
 161                     fileExistsAtPath: fileName2x])){