Title: [129573] trunk/Source/WebCore
- Revision
- 129573
- Author
- [email protected]
- Date
- 2012-09-25 16:35:13 -0700 (Tue, 25 Sep 2012)
Log Message
Load the linearized sRGB profile via NSData instead of CoreFoundation
https://bugs.webkit.org/show_bug.cgi?id=97616
Reviewed by Dan Bernstein.
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::linearRGBColorSpaceRef):
* platform/graphics/mac/GraphicsContextMac.mm:
(WebCore::linearRGBColorSpaceRef):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (129572 => 129573)
--- trunk/Source/WebCore/ChangeLog 2012-09-25 23:20:22 UTC (rev 129572)
+++ trunk/Source/WebCore/ChangeLog 2012-09-25 23:35:13 UTC (rev 129573)
@@ -1,3 +1,15 @@
+2012-09-25 Tim Horton <[email protected]>
+
+ Load the linearized sRGB profile via NSData instead of CoreFoundation
+ https://bugs.webkit.org/show_bug.cgi?id=97616
+
+ Reviewed by Dan Bernstein.
+
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::linearRGBColorSpaceRef):
+ * platform/graphics/mac/GraphicsContextMac.mm:
+ (WebCore::linearRGBColorSpaceRef):
+
2012-09-25 Mike West <[email protected]>
CSP logging: Be more developer-friendly when 'default-src' is violated.
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (129572 => 129573)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2012-09-25 23:20:22 UTC (rev 129572)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2012-09-25 23:35:13 UTC (rev 129573)
@@ -190,24 +190,6 @@
#endif // CACHE_SUBIMAGES
-static CGColorSpaceRef createLinearSRGBColorSpace()
-{
- // If we fail to load the linearized sRGB ICC profile, fall back to DeviceRGB.
- CGColorSpaceRef linearSRGBSpace = deviceRGBColorSpaceRef();
-
- CFBundleRef webCoreBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebCore"));
- RetainPtr<CFURLRef> iccProfileURL(CFBundleCopyResourceURL(webCoreBundle, CFSTR("linearSRGB"), CFSTR("icc"), 0));
- CFDataRef iccProfileData = 0;
-
- if (iccProfileURL && CFURLCreateDataAndPropertiesFromResource(0, iccProfileURL.get(), &iccProfileData, 0, 0, 0))
- linearSRGBSpace = CGColorSpaceCreateWithICCProfile(iccProfileData);
-
- if (iccProfileData)
- CFRelease(iccProfileData);
-
- return linearSRGBSpace;
-}
-
static void setCGFillColor(CGContextRef context, const Color& color, ColorSpace colorSpace)
{
CGContextSetFillColorWithColor(context, cachedCGColor(color, colorSpace));
@@ -235,16 +217,13 @@
#endif
}
+#if PLATFORM(WIN)
CGColorSpaceRef linearRGBColorSpaceRef()
{
// FIXME: Windows should be able to use linear sRGB, this is tracked by http://webkit.org/b/80000.
-#if PLATFORM(WIN)
return deviceRGBColorSpaceRef();
-#else
- static CGColorSpaceRef linearSRGBSpace = createLinearSRGBColorSpace();
- return linearSRGBSpace;
-#endif
}
+#endif
void GraphicsContext::platformInit(CGContextRef cgContext)
{
Modified: trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm (129572 => 129573)
--- trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm 2012-09-25 23:20:22 UTC (rev 129572)
+++ trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm 2012-09-25 23:35:13 UTC (rev 129573)
@@ -26,6 +26,7 @@
#import "config.h"
#import "GraphicsContext.h"
+#import "GraphicsContextCG.h"
#import "GraphicsContextPlatformPrivateCG.h"
#import <AppKit/AppKit.h>
#import <wtf/StdLibExtras.h>
@@ -178,4 +179,24 @@
CGContextRestoreGState(context);
}
+CGColorSpaceRef linearRGBColorSpaceRef()
+{
+ static CGColorSpaceRef linearSRGBSpace = 0;
+
+ if (linearSRGBSpace)
+ return linearSRGBSpace;
+
+ RetainPtr<NSString> iccProfilePath = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"linearSRGB" ofType:@"icc"];
+ RetainPtr<NSData> iccProfileData(AdoptNS, [[NSData alloc] initWithContentsOfFile:iccProfilePath.get()]);
+
+ if (iccProfileData)
+ linearSRGBSpace = CGColorSpaceCreateWithICCProfile((CFDataRef)iccProfileData.get());
+
+ // If we fail to load the linearized sRGB ICC profile, fall back to DeviceRGB.
+ if (!linearSRGBSpace)
+ return deviceRGBColorSpaceRef();
+
+ return linearSRGBSpace;
}
+
+}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes