Changeset 172197 in webkit
- Timestamp:
- Aug 6, 2014, 5:58:45 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r172195 r172197 1 2014-08-06 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [iOS] Make document marker assets not specific to particular scale factors 4 https://bugs.webkit.org/show_bug.cgi?id=135671 5 6 Reviewed by Simon Fraser. 7 8 No new tests. 9 10 * WebCore.xcodeproj/project.pbxproj: 11 * platform/ios/wak/WKGraphics.mm: 12 (imageResourcePath): 13 (WKGraphicsCreateImageFromBundleWithName): 14 1 15 2014-08-06 Enrica Casucci <enrica@apple.com> 2 16 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r172192 r172197 934 934 1C21E57C183ED1FF001C289D /* IOSurfacePool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C21E57A183ED1FF001C289D /* IOSurfacePool.cpp */; }; 935 935 1C21E57D183ED1FF001C289D /* IOSurfacePool.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C21E57B183ED1FF001C289D /* IOSurfacePool.h */; settings = {ATTRIBUTES = (Private, ); }; }; 936 1C2417BA1992C04100EF9938 /* SpellingDot@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1C2417B91992C04100EF9938 /* SpellingDot@3x.png */; }; 936 937 1C26497A0D7E248A00BD10F2 /* DocumentLoaderMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C2649790D7E248A00BD10F2 /* DocumentLoaderMac.cpp */; }; 937 938 1C26497C0D7E24EC00BD10F2 /* PageMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C26497B0D7E24EC00BD10F2 /* PageMac.cpp */; }; … … 7912 7913 1C21E57A183ED1FF001C289D /* IOSurfacePool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IOSurfacePool.cpp; path = ../cg/IOSurfacePool.cpp; sourceTree = "<group>"; }; 7913 7914 1C21E57B183ED1FF001C289D /* IOSurfacePool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IOSurfacePool.h; path = ../cg/IOSurfacePool.h; sourceTree = "<group>"; }; 7915 1C2417B91992C04100EF9938 /* SpellingDot@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "SpellingDot@3x.png"; sourceTree = "<group>"; }; 7914 7916 1C2649790D7E248A00BD10F2 /* DocumentLoaderMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentLoaderMac.cpp; sourceTree = "<group>"; }; 7915 7917 1C26497B0D7E24EC00BD10F2 /* PageMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageMac.cpp; sourceTree = "<group>"; }; … … 16525 16527 isa = PBXGroup; 16526 16528 children = ( 16529 1C2417B91992C04100EF9938 /* SpellingDot@3x.png */, 16527 16530 D02B64B014089E56006EFA21 /* DictationPhraseWithAlternativesDot.png */, 16528 16531 D02B64B114089E56006EFA21 /* DictationPhraseWithAlternativesDot@2x.png */, … … 26887 26890 files = ( 26888 26891 46F9D5DD0B0D60170028EE36 /* aliasCursor.png in Resources */, 26892 1C2417BA1992C04100EF9938 /* SpellingDot@3x.png in Resources */, 26889 26893 46D4F2490AF97E810035385A /* cellCursor.png in Resources */, 26890 26894 93153BDE141959F400FCF5BE /* deleteButton.png in Resources */, -
trunk/Source/WebCore/platform/ios/wak/WKGraphics.mm
r161603 r172197 92 92 } 93 93 94 static NSString *imageResourcePath(const char* imageFile, bool is2x)94 static NSString *imageResourcePath(const char* imageFile, unsigned scaleFactor) 95 95 { 96 NSString *fileName = is2x ? [NSString stringWithFormat:@"%s@2x", imageFile] : [NSString stringWithUTF8String:imageFile];96 NSString *fileName = scaleFactor == 1 ? [NSString stringWithUTF8String:imageFile] : [NSString stringWithFormat:@"%s@%dx", imageFile, scaleFactor]; 97 97 #if PLATFORM(IOS_SIMULATOR) 98 98 NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebCore"]; … … 105 105 } 106 106 107 CGImageRef WKGraphicsCreateImageFromBundleWithName 107 CGImageRef WKGraphicsCreateImageFromBundleWithName(const char *image_file) 108 108 { 109 109 if (!image_file) … … 111 111 112 112 CGImageRef image = nullptr; 113 NSData *imageData = nil; 114 115 if (wkGetScreenScaleFactor() == 2) { 116 NSString* full2xPath = imageResourcePath(image_file, true); 117 imageData = [NSData dataWithContentsOfFile:full2xPath]; 118 } 119 if (!imageData) { 120 // We got here either because we didn't request hi-dpi or the @2x file doesn't exist. 121 NSString* full1xPath = imageResourcePath(image_file, false); 122 imageData = [NSData dataWithContentsOfFile:full1xPath]; 113 NSData *imageData = nullptr; 114 for (unsigned scaleFactor = wkGetScreenScaleFactor(); scaleFactor > 0; --scaleFactor) { 115 imageData = [NSData dataWithContentsOfFile:imageResourcePath(image_file, scaleFactor)]; 116 ASSERT(scaleFactor != wkGetScreenScaleFactor() || imageData); 117 if (imageData) 118 break; 123 119 } 124 120
Note:
See TracChangeset
for help on using the changeset viewer.