Title: [294660] trunk/Source
- Revision
- 294660
- Author
- commit-qu...@webkit.org
- Date
- 2022-05-23 11:50:02 -0700 (Mon, 23 May 2022)
Log Message
Use kCGImageSourceCreateUnpremultipliedPNG on iOS family to correctly read PNG files without premultiplication.
https://bugs.webkit.org/show_bug.cgi?id=240137
<rdar://93198134>
Patch by John Cunningham <johncunning...@apple.com> on 2022-05-23
Reviewed by Simon Fraser.
* Source/WTF/wtf/PlatformHave.h:
* Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::createImageSourceOptions):
Canonical link: https://commits.webkit.org/250880@main
Modified Paths
Diff
Modified: trunk/Source/WTF/wtf/PlatformHave.h (294659 => 294660)
--- trunk/Source/WTF/wtf/PlatformHave.h 2022-05-23 18:36:14 UTC (rev 294659)
+++ trunk/Source/WTF/wtf/PlatformHave.h 2022-05-23 18:50:02 UTC (rev 294660)
@@ -1169,6 +1169,12 @@
#define HAVE_SKADNETWORK_v4 1
#endif
+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 160000) \
+ || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MAX_ALLOWED >= 90000) \
+ || (PLATFORM(APPLETV) && __TV_OS_VERSION_MAX_ALLOWED >= 160000)
+#define HAVE_IMAGEIO_CREATE_UNPREMULTIPLIED_PNG 1
+#endif
+
#if !defined(HAVE_UI_CONTEXT_MENU_PREVIEW_ITEM_IDENTIFIER) \
&& (((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 160000) \
|| (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 90000) \
Modified: trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp (294659 => 294660)
--- trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp 2022-05-23 18:36:14 UTC (rev 294659)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp 2022-05-23 18:50:02 UTC (rev 294660)
@@ -61,6 +61,10 @@
const CFStringRef kCGImageSourceEnableRestrictedDecoding = CFSTR("kCGImageSourceEnableRestrictedDecoding");
+#if HAVE(IMAGEIO_CREATE_UNPREMULTIPLIED_PNG)
+const CFStringRef kCGImageSourceCreateUnpremultipliedPNG = CFSTR("kCGImageSourceCreateUnpremultipliedPNG");
+#endif
+
static RetainPtr<CFMutableDictionaryRef> createImageSourceOptions()
{
RetainPtr<CFMutableDictionaryRef> options = adoptCF(CFDictionaryCreateMutable(nullptr, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
@@ -75,6 +79,10 @@
if (ImageDecoderCG::restrictedDecodingEnabled())
CFDictionarySetValue(options.get(), kCGImageSourceEnableRestrictedDecoding, kCFBooleanTrue);
#endif
+
+#if HAVE(IMAGEIO_CREATE_UNPREMULTIPLIED_PNG)
+ CFDictionarySetValue(options.get(), kCGImageSourceCreateUnpremultipliedPNG, kCFBooleanTrue);
+#endif
return options;
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes