Title: [276887] trunk/Source
Revision
276887
Author
wei...@apple.com
Date
2021-05-02 12:01:51 -0700 (Sun, 02 May 2021)

Log Message

Add support for DestinationColorSpace::DisplayP3 in preparation for DisplayP3 canvas
https://bugs.webkit.org/show_bug.cgi?id=225280

Reviewed by Anders Carlsson.

Add new ENABLE_DESTINATION_COLOR_SPACE_DISPLAY_P3 macro to declare which ports
support P3 backing stores. Currently, only the Apple/Cocoa ports support it.

Source/WebCore:

When ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3), also define ColorSpaceDestination::DisplayP3.
This is not currently used, but will be in subsequent changes.

* platform/graphics/ColorConversion.cpp:
(WebCore::converColorComponents):
* platform/graphics/ColorSpace.cpp:
(WebCore::operator<<):
* platform/graphics/ColorSpace.h:
(WebCore::callWithColorType):
* platform/graphics/cg/ColorSpaceCG.h:
(WebCore::cachedCGColorSpace):

Source/WTF:

* wtf/PlatformEnable.h:
* wtf/PlatformEnableCocoa.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (276886 => 276887)


--- trunk/Source/WTF/ChangeLog	2021-05-02 16:59:56 UTC (rev 276886)
+++ trunk/Source/WTF/ChangeLog	2021-05-02 19:01:51 UTC (rev 276887)
@@ -1,3 +1,16 @@
+2021-05-02  Sam Weinig  <wei...@apple.com>
+
+        Add support for DestinationColorSpace::DisplayP3 in preparation for DisplayP3 canvas
+        https://bugs.webkit.org/show_bug.cgi?id=225280
+
+        Reviewed by Anders Carlsson.
+
+        Add new ENABLE_DESTINATION_COLOR_SPACE_DISPLAY_P3 macro to declare which ports
+        support P3 backing stores. Currently, only the Apple/Cocoa ports support it.
+
+        * wtf/PlatformEnable.h:
+        * wtf/PlatformEnableCocoa.h:
+
 2021-04-30  Darin Adler  <da...@apple.com>
 
         Use SortedArrayMap in a few more places

Modified: trunk/Source/WTF/wtf/PlatformEnable.h (276886 => 276887)


--- trunk/Source/WTF/wtf/PlatformEnable.h	2021-05-02 16:59:56 UTC (rev 276886)
+++ trunk/Source/WTF/wtf/PlatformEnable.h	2021-05-02 19:01:51 UTC (rev 276887)
@@ -245,6 +245,10 @@
 #define ENABLE_DEVICE_ORIENTATION 0
 #endif
 
+#if !defined(ENABLE_DESTINATION_COLOR_SPACE_DISPLAY_P3)
+#define ENABLE_DESTINATION_COLOR_SPACE_DISPLAY_P3 0
+#endif
+
 #if !defined(ENABLE_DESTINATION_COLOR_SPACE_LINEAR_SRGB)
 #define ENABLE_DESTINATION_COLOR_SPACE_LINEAR_SRGB 1
 #endif
@@ -901,6 +905,10 @@
 
 #if USE(CG)
 
+#if ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3) && !HAVE(CORE_GRAPHICS_DISPLAY_P3_COLOR_SPACE)
+#error "ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3) requires HAVE(CORE_GRAPHICS_DISPLAY_P3_COLOR_SPACE) on platforms using CoreGraphics"
+#endif
+
 #if ENABLE(DESTINATION_COLOR_SPACE_LINEAR_SRGB) && !HAVE(CORE_GRAPHICS_LINEAR_SRGB_COLOR_SPACE)
 #error "ENABLE(DESTINATION_COLOR_SPACE_LINEAR_SRGB) requires HAVE(CORE_GRAPHICS_LINEAR_SRGB_COLOR_SPACE) on platforms using CoreGraphics"
 #endif

Modified: trunk/Source/WTF/wtf/PlatformEnableCocoa.h (276886 => 276887)


--- trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2021-05-02 16:59:56 UTC (rev 276886)
+++ trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2021-05-02 19:01:51 UTC (rev 276887)
@@ -671,6 +671,10 @@
 #define ENABLE_APP_BOUND_REQUESTS 1
 #endif
 
+#if !defined(ENABLE_DESTINATION_COLOR_SPACE_DISPLAY_P3)
+#define ENABLE_DESTINATION_COLOR_SPACE_DISPLAY_P3 1
+#endif
+
 #if !defined(ENABLE_DESTINATION_COLOR_SPACE_LINEAR_SRGB)
 #define ENABLE_DESTINATION_COLOR_SPACE_LINEAR_SRGB 1
 #endif

Modified: trunk/Source/WebCore/ChangeLog (276886 => 276887)


--- trunk/Source/WebCore/ChangeLog	2021-05-02 16:59:56 UTC (rev 276886)
+++ trunk/Source/WebCore/ChangeLog	2021-05-02 19:01:51 UTC (rev 276887)
@@ -1,3 +1,25 @@
+2021-05-02  Sam Weinig  <wei...@apple.com>
+
+        Add support for DestinationColorSpace::DisplayP3 in preparation for DisplayP3 canvas
+        https://bugs.webkit.org/show_bug.cgi?id=225280
+
+        Reviewed by Anders Carlsson.
+
+        Add new ENABLE_DESTINATION_COLOR_SPACE_DISPLAY_P3 macro to declare which ports
+        support P3 backing stores. Currently, only the Apple/Cocoa ports support it.
+
+        When ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3), also define ColorSpaceDestination::DisplayP3.
+        This is not currently used, but will be in subsequent changes.
+
+        * platform/graphics/ColorConversion.cpp:
+        (WebCore::converColorComponents):
+        * platform/graphics/ColorSpace.cpp:
+        (WebCore::operator<<):
+        * platform/graphics/ColorSpace.h:
+        (WebCore::callWithColorType):
+        * platform/graphics/cg/ColorSpaceCG.h:
+        (WebCore::cachedCGColorSpace):
+
 2021-05-02  Zalan Bujtas  <za...@apple.com>
 
         [LFC] Rename block(inline/table/flex)formattingContext directories to block(inline/table/flex)

Modified: trunk/Source/WebCore/platform/graphics/ColorConversion.cpp (276886 => 276887)


--- trunk/Source/WebCore/platform/graphics/ColorConversion.cpp	2021-05-02 16:59:56 UTC (rev 276886)
+++ trunk/Source/WebCore/platform/graphics/ColorConversion.cpp	2021-05-02 19:01:51 UTC (rev 276887)
@@ -328,6 +328,10 @@
         case DestinationColorSpace::LinearSRGB:
             return asColorComponents(convertColor<LinearSRGBA<float>>(inputColor));
 #endif
+#if ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3)
+        case DestinationColorSpace::DisplayP3:
+            return asColorComponents(convertColor<DisplayP3<float>>(inputColor));
+#endif
         }
 
         ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/platform/graphics/ColorSpace.cpp (276886 => 276887)


--- trunk/Source/WebCore/platform/graphics/ColorSpace.cpp	2021-05-02 16:59:56 UTC (rev 276886)
+++ trunk/Source/WebCore/platform/graphics/ColorSpace.cpp	2021-05-02 19:01:51 UTC (rev 276887)
@@ -75,6 +75,11 @@
         ts << "LinearSRGB";
         break;
 #endif
+#if ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3)
+    case DestinationColorSpace::DisplayP3:
+        ts << "DisplayP3";
+        break;
+#endif
     }
     return ts;
 }

Modified: trunk/Source/WebCore/platform/graphics/ColorSpace.h (276886 => 276887)


--- trunk/Source/WebCore/platform/graphics/ColorSpace.h	2021-05-02 16:59:56 UTC (rev 276886)
+++ trunk/Source/WebCore/platform/graphics/ColorSpace.h	2021-05-02 19:01:51 UTC (rev 276887)
@@ -52,6 +52,9 @@
 #if ENABLE(DESTINATION_COLOR_SPACE_LINEAR_SRGB)
     , LinearSRGB
 #endif
+#if ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3)
+    , DisplayP3
+#endif
 };
 
 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ColorSpace);
@@ -108,6 +111,10 @@
     case DestinationColorSpace::LinearSRGB:
         return std::invoke(std::forward<Functor>(functor), makeFromComponents<LinearSRGBA<T>>(components));
 #endif
+#if ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3)
+    case DestinationColorSpace::DisplayP3:
+        return std::invoke(std::forward<Functor>(functor), makeFromComponents<DisplayP3<T>>(components));
+#endif
     }
 
     ASSERT_NOT_REACHED();
@@ -141,6 +148,9 @@
 #if ENABLE(DESTINATION_COLOR_SPACE_LINEAR_SRGB)
         , WebCore::DestinationColorSpace::LinearSRGB
 #endif
+#if ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3)
+        , WebCore::DestinationColorSpace::DisplayP3
+#endif
     >;
 };
 

Modified: trunk/Source/WebCore/platform/graphics/cg/ColorSpaceCG.h (276886 => 276887)


--- trunk/Source/WebCore/platform/graphics/cg/ColorSpaceCG.h	2021-05-02 16:59:56 UTC (rev 276886)
+++ trunk/Source/WebCore/platform/graphics/cg/ColorSpaceCG.h	2021-05-02 19:01:51 UTC (rev 276887)
@@ -129,6 +129,10 @@
     case DestinationColorSpace::LinearSRGB:
         return linearSRGBColorSpaceRef();
 #endif
+#if ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3)
+    case DestinationColorSpace::DisplayP3:
+        return displayP3ColorSpaceRef();
+#endif
     }
     ASSERT_NOT_REACHED();
     return sRGBColorSpaceRef();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to