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