<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[277450] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/277450">277450</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2021-05-13 13:54:21 -0700 (Thu, 13 May 2021)</dd>
</dl>
<h3>Log Message</h3>
<pre>Split pixel buffer format data out into a new PixelBufferFormat struct
https://bugs.webkit.org/show_bug.cgi?id=225707
Reviewed by Darin Adler.
Source/WebCore:
Splits out PixelBufferFormat into a new struct and adopts it by PixelBufferConversionView,
ConstPixelBufferConversionView and PixelBuffer. This also means that PixelBuffer now
tracks the alpha format of the underlying buffer which will come in handy.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new files.
* platform/graphics/AlphaPremultiplication.cpp: Added.
(WebCore::operator<<):
Add AlphaPremultiplication.cpp and move TextStream support
here from GraphicsTypes.cpp.
* platform/graphics/GraphicsTypes.cpp:
Move AlphaPremultiplication TextStream to the more appropriate
AlphaPremultiplication.cpp.
* html/ImageData.cpp:
(WebCore::ImageData::create):
* html/ImageData.h:
(WebCore::ImageData::colorSpace const): Deleted.
(WebCore::ImageData::format const): Deleted.
* platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::toBGRAData const):
(WebCore::ImageBufferBackend::getPixelBuffer const):
(WebCore::ImageBufferBackend::putPixelBuffer):
* platform/graphics/ImageBufferBackend.h:
* platform/graphics/PixelBuffer.cpp:
(WebCore::PixelBuffer::computeBufferSize):
(WebCore::PixelBuffer::tryCreateForDecoding):
(WebCore::PixelBuffer::tryCreate):
(WebCore::PixelBuffer::PixelBuffer):
(WebCore::PixelBuffer::deepClone const):
(WebCore::operator<<):
* platform/graphics/PixelBuffer.h:
(WebCore::PixelBuffer::format const):
(WebCore::PixelBuffer::encode const):
(WebCore::PixelBuffer::decode):
(WebCore::PixelBuffer::colorSpace const): Deleted.
* platform/graphics/PixelBufferConversion.cpp:
(WebCore::convertImagePixelsAccelerated):
(WebCore::convertImagePixels):
* platform/graphics/PixelBufferConversion.h:
* platform/graphics/PixelBufferFormat.cpp: Added.
(WebCore::operator<<):
* platform/graphics/PixelBufferFormat.h: Added.
(WebCore::PixelBufferFormat::encode const):
(WebCore::PixelBufferFormat::decode):
* platform/graphics/PixelFormat.cpp: Added.
(WebCore::operator<<):
* platform/graphics/PixelFormat.h:
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::readPixelsForPaintResults):
* platform/graphics/cg/GraphicsContextGLCG.cpp:
(WebCore::GraphicsContextGLOpenGL::paintToCanvas):
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::toCFData const):
* platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
(WebCore::cfData):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::copyUnmultipliedResult):
(WebCore::FilterEffect::copyPremultipliedResult):
(WebCore::FilterEffect::createUnmultipliedImageResult):
(WebCore::FilterEffect::createPremultipliedImageResult):
Adopt PixelBufferFormat.
Source/WebKit:
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
Adopt PixelBufferFormat.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreHeaderscmake">trunk/Source/WebCore/Headers.cmake</a></li>
<li><a href="#trunkSourceWebCoreSourcestxt">trunk/Source/WebCore/Sources.txt</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorehtmlImageDatacpp">trunk/Source/WebCore/html/ImageData.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlImageDatah">trunk/Source/WebCore/html/ImageData.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsAlphaPremultiplicationh">trunk/Source/WebCore/platform/graphics/AlphaPremultiplication.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsTypescpp">trunk/Source/WebCore/platform/graphics/GraphicsTypes.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsImageBufferBackendcpp">trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsImageBufferBackendh">trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsPixelBuffercpp">trunk/Source/WebCore/platform/graphics/PixelBuffer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsPixelBufferh">trunk/Source/WebCore/platform/graphics/PixelBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsPixelBufferConversioncpp">trunk/Source/WebCore/platform/graphics/PixelBufferConversion.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsPixelBufferConversionh">trunk/Source/WebCore/platform/graphics/PixelBufferConversion.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsPixelFormath">trunk/Source/WebCore/platform/graphics/PixelFormat.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsangleGraphicsContextGLANGLEcpp">trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgGraphicsContextGLCGcpp">trunk/Source/WebCore/platform/graphics/cg/GraphicsContextGLCG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgImageBufferCGBackendcpp">trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgImageBufferUtilitiesCGcpp">trunk/Source/WebCore/platform/graphics/cg/ImageBufferUtilitiesCG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterEffectcpp">trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGraphicsContextGLOpenGLBasecpp">trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGraphicsContextGLOpenGLEScpp">trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUgraphicsRemoteImageBufferProxyh">trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgraphicsAlphaPremultiplicationcpp">trunk/Source/WebCore/platform/graphics/AlphaPremultiplication.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsPixelBufferFormatcpp">trunk/Source/WebCore/platform/graphics/PixelBufferFormat.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsPixelBufferFormath">trunk/Source/WebCore/platform/graphics/PixelBufferFormat.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsPixelFormatcpp">trunk/Source/WebCore/platform/graphics/PixelFormat.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/ChangeLog 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -1,3 +1,77 @@
</span><ins>+2021-05-13 Sam Weinig <weinig@apple.com>
+
+ Split pixel buffer format data out into a new PixelBufferFormat struct
+ https://bugs.webkit.org/show_bug.cgi?id=225707
+
+ Reviewed by Darin Adler.
+
+ Splits out PixelBufferFormat into a new struct and adopts it by PixelBufferConversionView,
+ ConstPixelBufferConversionView and PixelBuffer. This also means that PixelBuffer now
+ tracks the alpha format of the underlying buffer which will come in handy.
+
+ * Headers.cmake:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ Add new files.
+
+ * platform/graphics/AlphaPremultiplication.cpp: Added.
+ (WebCore::operator<<):
+ Add AlphaPremultiplication.cpp and move TextStream support
+ here from GraphicsTypes.cpp.
+
+ * platform/graphics/GraphicsTypes.cpp:
+ Move AlphaPremultiplication TextStream to the more appropriate
+ AlphaPremultiplication.cpp.
+
+ * html/ImageData.cpp:
+ (WebCore::ImageData::create):
+ * html/ImageData.h:
+ (WebCore::ImageData::colorSpace const): Deleted.
+ (WebCore::ImageData::format const): Deleted.
+ * platform/graphics/ImageBufferBackend.cpp:
+ (WebCore::ImageBufferBackend::toBGRAData const):
+ (WebCore::ImageBufferBackend::getPixelBuffer const):
+ (WebCore::ImageBufferBackend::putPixelBuffer):
+ * platform/graphics/ImageBufferBackend.h:
+ * platform/graphics/PixelBuffer.cpp:
+ (WebCore::PixelBuffer::computeBufferSize):
+ (WebCore::PixelBuffer::tryCreateForDecoding):
+ (WebCore::PixelBuffer::tryCreate):
+ (WebCore::PixelBuffer::PixelBuffer):
+ (WebCore::PixelBuffer::deepClone const):
+ (WebCore::operator<<):
+ * platform/graphics/PixelBuffer.h:
+ (WebCore::PixelBuffer::format const):
+ (WebCore::PixelBuffer::encode const):
+ (WebCore::PixelBuffer::decode):
+ (WebCore::PixelBuffer::colorSpace const): Deleted.
+ * platform/graphics/PixelBufferConversion.cpp:
+ (WebCore::convertImagePixelsAccelerated):
+ (WebCore::convertImagePixels):
+ * platform/graphics/PixelBufferConversion.h:
+ * platform/graphics/PixelBufferFormat.cpp: Added.
+ (WebCore::operator<<):
+ * platform/graphics/PixelBufferFormat.h: Added.
+ (WebCore::PixelBufferFormat::encode const):
+ (WebCore::PixelBufferFormat::decode):
+ * platform/graphics/PixelFormat.cpp: Added.
+ (WebCore::operator<<):
+ * platform/graphics/PixelFormat.h:
+ * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+ (WebCore::GraphicsContextGLOpenGL::readPixelsForPaintResults):
+ * platform/graphics/cg/GraphicsContextGLCG.cpp:
+ (WebCore::GraphicsContextGLOpenGL::paintToCanvas):
+ * platform/graphics/cg/ImageBufferCGBackend.cpp:
+ (WebCore::ImageBufferCGBackend::toCFData const):
+ * platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
+ (WebCore::cfData):
+ * platform/graphics/filters/FilterEffect.cpp:
+ (WebCore::FilterEffect::copyUnmultipliedResult):
+ (WebCore::FilterEffect::copyPremultipliedResult):
+ (WebCore::FilterEffect::createUnmultipliedImageResult):
+ (WebCore::FilterEffect::createPremultipliedImageResult):
+ Adopt PixelBufferFormat.
+
</ins><span class="cx"> 2021-05-13 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Rename FileSystem::directoryName() to FileSystem::parentPath()
</span></span></pre></div>
<a id="trunkSourceWebCoreHeaderscmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Headers.cmake (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Headers.cmake 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/Headers.cmake 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -1290,6 +1290,7 @@
</span><span class="cx"> platform/graphics/PathUtilities.h
</span><span class="cx"> platform/graphics/Pattern.h
</span><span class="cx"> platform/graphics/PixelBuffer.h
</span><ins>+ platform/graphics/PixelBufferFormat.h
</ins><span class="cx"> platform/graphics/PixelFormat.h
</span><span class="cx"> platform/graphics/PlatformDisplay.h
</span><span class="cx"> platform/graphics/PlatformImage.h
</span></span></pre></div>
<a id="trunkSourceWebCoreSourcestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Sources.txt (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Sources.txt 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/Sources.txt 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -1938,6 +1938,7 @@
</span><span class="cx"> platform/gamepad/EmptyGamepadProvider.cpp
</span><span class="cx"> platform/gamepad/GamepadConstants.cpp
</span><span class="cx"> platform/gamepad/GamepadProvider.cpp
</span><ins>+platform/graphics/AlphaPremultiplication.cpp
</ins><span class="cx"> platform/graphics/AnimationFrameRate.cpp
</span><span class="cx"> platform/graphics/BitmapImage.cpp
</span><span class="cx"> platform/graphics/Color.cpp
</span><span class="lines">@@ -2015,6 +2016,8 @@
</span><span class="cx"> platform/graphics/Pattern.cpp
</span><span class="cx"> platform/graphics/PixelBuffer.cpp
</span><span class="cx"> platform/graphics/PixelBufferConversion.cpp
</span><ins>+platform/graphics/PixelBufferFormat.cpp
+platform/graphics/PixelFormat.cpp
</ins><span class="cx"> platform/graphics/PlatformTimeRanges.cpp
</span><span class="cx"> platform/graphics/Region.cpp
</span><span class="cx"> platform/graphics/RemoteGraphicsContextGLProxyBase.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -4058,6 +4058,8 @@
</span><span class="cx"> BC6049CC0DB560C200204739 /* CSSCanvasValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6049CB0DB560C200204739 /* CSSCanvasValue.h */; };
</span><span class="cx"> BC60D6E90D28D83400B9918F /* DOMException.h in Headers */ = {isa = PBXBuildFile; fileRef = BC60D6E80D28D83400B9918F /* DOMException.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx"> BC60D7C10D29A46300B9918F /* JSDOMException.h in Headers */ = {isa = PBXBuildFile; fileRef = BC60D7BF0D29A46300B9918F /* JSDOMException.h */; };
</span><ins>+ BC635E8C264C2CAE000EF33A /* PixelBufferFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = BC635E8B264C2CAE000EF33A /* PixelBufferFormat.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC635E8E264C2CE7000EF33A /* PixelBufferConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0CA74C264AED0A004FDC62 /* PixelBufferConversion.h */; };
</ins><span class="cx"> BC64640A11D7F304006455B0 /* DOMStringMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64640811D7F304006455B0 /* DOMStringMap.h */; };
</span><span class="cx"> BC64641C11D7F416006455B0 /* DatasetDOMStringMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64641A11D7F416006455B0 /* DatasetDOMStringMap.h */; };
</span><span class="cx"> BC64649811D82349006455B0 /* JSDOMStringMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64649611D82349006455B0 /* JSDOMStringMap.h */; };
</span><span class="lines">@@ -14247,6 +14249,10 @@
</span><span class="cx"> BC60D6EB0D28D99900B9918F /* DOMException.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMException.idl; sourceTree = "<group>"; };
</span><span class="cx"> BC60D7BE0D29A46300B9918F /* JSDOMException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMException.cpp; sourceTree = "<group>"; };
</span><span class="cx"> BC60D7BF0D29A46300B9918F /* JSDOMException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMException.h; sourceTree = "<group>"; };
</span><ins>+ BC635E8B264C2CAE000EF33A /* PixelBufferFormat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PixelBufferFormat.h; sourceTree = "<group>"; };
+ BC635E8F264C2ECE000EF33A /* PixelBufferFormat.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PixelBufferFormat.cpp; sourceTree = "<group>"; };
+ BC635E90264C469F000EF33A /* PixelFormat.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PixelFormat.cpp; sourceTree = "<group>"; };
+ BC635E91264C4760000EF33A /* AlphaPremultiplication.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AlphaPremultiplication.cpp; sourceTree = "<group>"; };
</ins><span class="cx"> BC64640811D7F304006455B0 /* DOMStringMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMStringMap.h; sourceTree = "<group>"; };
</span><span class="cx"> BC64641A11D7F416006455B0 /* DatasetDOMStringMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatasetDOMStringMap.h; sourceTree = "<group>"; };
</span><span class="cx"> BC64641B11D7F416006455B0 /* DatasetDOMStringMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatasetDOMStringMap.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -26850,6 +26856,7 @@
</span><span class="cx"> FBC220DD1237FBEB00BCF788 /* opengl */,
</span><span class="cx"> 3721493318F0B6D600156EDC /* opentype */,
</span><span class="cx"> 49E911B20EF86D27009D0CAF /* transforms */,
</span><ins>+ BC635E91264C4760000EF33A /* AlphaPremultiplication.cpp */,
</ins><span class="cx"> 7299BC6423D686A600CC6883 /* AlphaPremultiplication.h */,
</span><span class="cx"> 0F7E475325EEB79B0013F909 /* ANGLEWebKitBridge.cpp */,
</span><span class="cx"> 0F7E475425EEB79B0013F909 /* ANGLEWebKitBridge.h */,
</span><span class="lines">@@ -27059,6 +27066,9 @@
</span><span class="cx"> BC4839BA2646181A00A28B62 /* PixelBuffer.h */,
</span><span class="cx"> BC0CA74D264AED0A004FDC62 /* PixelBufferConversion.cpp */,
</span><span class="cx"> BC0CA74C264AED0A004FDC62 /* PixelBufferConversion.h */,
</span><ins>+ BC635E8F264C2ECE000EF33A /* PixelBufferFormat.cpp */,
+ BC635E8B264C2CAE000EF33A /* PixelBufferFormat.h */,
+ BC635E90264C469F000EF33A /* PixelFormat.cpp */,
</ins><span class="cx"> BCA55912263DBD79007F19B3 /* PixelFormat.h */,
</span><span class="cx"> 726D56E1253AE0430002EF90 /* PlatformImage.h */,
</span><span class="cx"> 72BAC3A623E17328008D741C /* PlatformImageBuffer.h */,
</span><span class="lines">@@ -34471,6 +34481,8 @@
</span><span class="cx"> D0FF2A5E11F8C45A007E74E0 /* PingLoader.h in Headers */,
</span><span class="cx"> BCE691E5264637FC00EBDC3A /* PixelBuffer.h in Headers */,
</span><span class="cx"> CD7D33441C7A123F00041293 /* PixelBufferConformerCV.h in Headers */,
</span><ins>+ BC635E8E264C2CE7000EF33A /* PixelBufferConversion.h in Headers */,
+ BC635E8C264C2CAE000EF33A /* PixelBufferFormat.h in Headers */,
</ins><span class="cx"> BCA55914263DBD79007F19B3 /* PixelFormat.h in Headers */,
</span><span class="cx"> CDEFA2281E7669E8000AE99C /* PlatformAudioData.h in Headers */,
</span><span class="cx"> 499B3EDD128DB50200E726C2 /* PlatformCAAnimation.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlImageDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/ImageData.cpp (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/ImageData.cpp 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/html/ImageData.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -63,7 +63,8 @@
</span><span class="cx"> auto byteArray = Uint8ClampedArray::tryCreateUninitialized(dataSize.unsafeGet());
</span><span class="cx"> if (!byteArray)
</span><span class="cx"> return nullptr;
</span><del>- return adoptRef(*new ImageData({ DestinationColorSpace::SRGB, PixelFormat::RGBA8, size, byteArray.releaseNonNull() }));
</del><ins>+
+ return adoptRef(*new ImageData({ { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB }, size, byteArray.releaseNonNull() }));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<ImageData> ImageData::create(const IntSize& size, Ref<Uint8ClampedArray>&& byteArray)
</span><span class="lines">@@ -72,7 +73,7 @@
</span><span class="cx"> if (dataSize.hasOverflowed() || dataSize.unsafeGet() > byteArray->length())
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- return adoptRef(*new ImageData({ DestinationColorSpace::SRGB, PixelFormat::RGBA8, size, WTFMove(byteArray) }));
</del><ins>+ return adoptRef(*new ImageData({ { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB }, size, WTFMove(byteArray) }));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ExceptionOr<Ref<ImageData>> ImageData::create(unsigned sw, unsigned sh)
</span><span class="lines">@@ -89,7 +90,7 @@
</span><span class="cx"> return Exception { RangeError, "Out of memory"_s };
</span><span class="cx"> }
</span><span class="cx"> byteArray->zeroFill();
</span><del>- return adoptRef(*new ImageData({ DestinationColorSpace::SRGB, PixelFormat::RGBA8, size, byteArray.releaseNonNull() }));
</del><ins>+ return adoptRef(*new ImageData({ { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB }, size, byteArray.releaseNonNull() }));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ExceptionOr<Ref<ImageData>> ImageData::create(Ref<Uint8ClampedArray>&& byteArray, unsigned sw, Optional<unsigned> sh)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlImageDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/ImageData.h (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/ImageData.h 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/html/ImageData.h 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -51,9 +51,6 @@
</span><span class="cx">
</span><span class="cx"> Ref<ImageData> deepClone() const;
</span><span class="cx">
</span><del>- DestinationColorSpace colorSpace() const { return m_pixelBuffer.colorSpace(); }
- PixelFormat format() const { return m_pixelBuffer.format(); }
-
</del><span class="cx"> const PixelBuffer& pixelBuffer() const { return m_pixelBuffer; }
</span><span class="cx">
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsAlphaPremultiplicationcppfromrev277449trunkSourceWebCoreplatformgraphicsPixelFormath"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/AlphaPremultiplication.cpp (from rev 277449, trunk/Source/WebCore/platform/graphics/PixelFormat.h) (0 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/AlphaPremultiplication.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/AlphaPremultiplication.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AlphaPremultiplication.h"
+
+#include <wtf/text/TextStream.h>
+
+namespace WebCore {
+
+TextStream& operator<<(TextStream& ts, AlphaPremultiplication premultiplication)
+{
+ switch (premultiplication) {
+ case AlphaPremultiplication::Premultiplied:
+ ts << "premultiplied";
+ break;
+ case AlphaPremultiplication::Unpremultiplied:
+ ts << "unpremultiplied";
+ break;
+ }
+ return ts;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsAlphaPremultiplicationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/AlphaPremultiplication.h (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/AlphaPremultiplication.h 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/AlphaPremultiplication.h 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace WTF {
</span><ins>+
</ins><span class="cx"> template<> struct EnumTraits<WebCore::AlphaPremultiplication> {
</span><span class="cx"> using values = EnumValues<
</span><span class="cx"> WebCore::AlphaPremultiplication,
</span><span class="lines">@@ -47,4 +48,5 @@
</span><span class="cx"> WebCore::AlphaPremultiplication::Unpremultiplied
</span><span class="cx"> >;
</span><span class="cx"> };
</span><ins>+
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsTypescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsTypes.cpp (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsTypes.cpp 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/GraphicsTypes.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -182,17 +182,4 @@
</span><span class="cx"> return ts;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TextStream& operator<<(TextStream& ts, AlphaPremultiplication premultiplication)
-{
- switch (premultiplication) {
- case AlphaPremultiplication::Premultiplied:
- ts << "premultiplied";
- break;
- case AlphaPremultiplication::Unpremultiplied:
- ts << "unpremultiplied";
- break;
- }
- return ts;
-}
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsImageBufferBackendcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -95,17 +95,16 @@
</span><span class="cx"> {
</span><span class="cx"> Vector<uint8_t> result(4 * logicalSize().area().unsafeGet());
</span><span class="cx">
</span><ins>+ PixelBufferFormat sourceFormat { AlphaPremultiplication::Premultiplied, pixelFormat(), DestinationColorSpace::SRGB };
+ PixelBufferFormat destinationFormat { AlphaPremultiplication::Unpremultiplied, PixelFormat::BGRA8, DestinationColorSpace::SRGB };
+
</ins><span class="cx"> ConstPixelBufferConversionView source;
</span><del>- source.alphaFormat = AlphaPremultiplication::Premultiplied;
- source.colorSpace = DestinationColorSpace::SRGB;
- source.pixelFormat = pixelFormat();
</del><ins>+ source.format = sourceFormat;
</ins><span class="cx"> source.bytesPerRow = bytesPerRow();
</span><span class="cx"> source.rows = reinterpret_cast<const uint8_t*>(data);
</span><span class="cx">
</span><span class="cx"> PixelBufferConversionView destination;
</span><del>- destination.alphaFormat = AlphaPremultiplication::Unpremultiplied;
- destination.colorSpace = DestinationColorSpace::SRGB;
- destination.pixelFormat = PixelFormat::BGRA8;
</del><ins>+ destination.format = destinationFormat;
</ins><span class="cx"> destination.bytesPerRow = logicalSize().width() * 4;
</span><span class="cx"> destination.rows = result.data();
</span><span class="cx">
</span><span class="lines">@@ -118,9 +117,9 @@
</span><span class="cx"> {
</span><span class="cx"> auto sourceRectScaled = toBackendCoordinates(sourceRect);
</span><span class="cx">
</span><del>- auto destinationPixelFormat = PixelFormat::RGBA8;
</del><ins>+ PixelBufferFormat destinationFormat { destinationAlphaFormat, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
</ins><span class="cx">
</span><del>- auto pixelBuffer = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, destinationPixelFormat, sourceRectScaled.size());
</del><ins>+ auto pixelBuffer = PixelBuffer::tryCreate(destinationFormat, sourceRectScaled.size());
</ins><span class="cx"> if (!pixelBuffer)
</span><span class="cx"> return WTF::nullopt;
</span><span class="cx">
</span><span class="lines">@@ -142,17 +141,15 @@
</span><span class="cx"> unsigned destinationBytesPerRow = 4 * sourceRectScaled.width();
</span><span class="cx"> uint8_t* destinationRows = pixelBuffer->data().data() + destinationRect.y() * destinationBytesPerRow + destinationRect.x() * 4;
</span><span class="cx">
</span><ins>+ PixelBufferFormat sourceFormat { AlphaPremultiplication::Premultiplied, pixelFormat(), DestinationColorSpace::SRGB };
+
</ins><span class="cx"> ConstPixelBufferConversionView source;
</span><del>- source.alphaFormat = AlphaPremultiplication::Premultiplied;
- source.colorSpace = DestinationColorSpace::SRGB;
- source.pixelFormat = pixelFormat();
</del><ins>+ source.format = sourceFormat;
</ins><span class="cx"> source.bytesPerRow = sourceBytesPerRow;
</span><span class="cx"> source.rows = sourceRows;
</span><span class="cx">
</span><span class="cx"> PixelBufferConversionView destination;
</span><del>- destination.alphaFormat = destinationAlphaFormat;
- destination.colorSpace = DestinationColorSpace::SRGB;
- destination.pixelFormat = destinationPixelFormat;
</del><ins>+ destination.format = destinationFormat;
</ins><span class="cx"> destination.bytesPerRow = destinationBytesPerRow;
</span><span class="cx"> destination.rows = destinationRows;
</span><span class="cx">
</span><span class="lines">@@ -164,7 +161,7 @@
</span><span class="cx"> void ImageBufferBackend::putPixelBuffer(AlphaPremultiplication sourceAlphaFormat, const PixelBuffer& pixelBuffer, const IntRect& sourceRect, const IntPoint& destinationPoint, AlphaPremultiplication destinationAlphaFormat, void* data)
</span><span class="cx"> {
</span><span class="cx"> // FIXME: Add support for non-RGBA8 pixel formats.
</span><del>- ASSERT(pixelBuffer.format() == PixelFormat::RGBA8);
</del><ins>+ ASSERT(pixelBuffer.format().pixelFormat == PixelFormat::RGBA8);
</ins><span class="cx">
</span><span class="cx"> auto sourceRectScaled = toBackendCoordinates(sourceRect);
</span><span class="cx"> auto destinationPointScaled = toBackendCoordinates(destinationPoint);
</span><span class="lines">@@ -188,17 +185,16 @@
</span><span class="cx"> unsigned destinationBytesPerRow = bytesPerRow();
</span><span class="cx"> uint8_t* destinationRows = reinterpret_cast<uint8_t*>(data) + destinationRect.y() * destinationBytesPerRow + destinationRect.x() * 4;
</span><span class="cx">
</span><ins>+ PixelBufferFormat sourceFormat { sourceAlphaFormat, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
+ PixelBufferFormat destinationFormat { destinationAlphaFormat, pixelFormat(), DestinationColorSpace::SRGB };
+
</ins><span class="cx"> ConstPixelBufferConversionView source;
</span><del>- source.alphaFormat = sourceAlphaFormat;
- source.colorSpace = DestinationColorSpace::SRGB;
- source.pixelFormat = PixelFormat::RGBA8;
</del><ins>+ source.format = sourceFormat;
</ins><span class="cx"> source.bytesPerRow = sourceBytesPerRow;
</span><span class="cx"> source.rows = sourceRows;
</span><span class="cx">
</span><span class="cx"> PixelBufferConversionView destination;
</span><del>- destination.alphaFormat = destinationAlphaFormat;
- destination.colorSpace = DestinationColorSpace::SRGB;
- destination.pixelFormat = pixelFormat();
</del><ins>+ destination.format = destinationFormat;
</ins><span class="cx"> destination.bytesPerRow = destinationBytesPerRow;
</span><span class="cx"> destination.rows = destinationRows;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsImageBufferBackendh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -162,9 +162,9 @@
</span><span class="cx">
</span><span class="cx"> template<> struct EnumTraits<WebCore::PreserveResolution> {
</span><span class="cx"> using values = EnumValues<
</span><del>- WebCore::PreserveResolution,
- WebCore::PreserveResolution::No,
- WebCore::PreserveResolution::Yes
</del><ins>+ WebCore::PreserveResolution,
+ WebCore::PreserveResolution::No,
+ WebCore::PreserveResolution::Yes
</ins><span class="cx"> >;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPixelBuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/PixelBuffer.cpp (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/PixelBuffer.cpp 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/PixelBuffer.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -31,10 +31,10 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-Checked<unsigned, RecordOverflow> PixelBuffer::computeBufferSize(PixelFormat format, const IntSize& size)
</del><ins>+Checked<unsigned, RecordOverflow> PixelBuffer::computeBufferSize(const PixelBufferFormat& format, const IntSize& size)
</ins><span class="cx"> {
</span><span class="cx"> // NOTE: Only 8-bit formats are currently supported.
</span><del>- ASSERT_UNUSED(format, format == PixelFormat::RGBA8 || format == PixelFormat::BGRA8);
</del><ins>+ ASSERT_UNUSED(format, format.pixelFormat == PixelFormat::RGBA8 || format.pixelFormat == PixelFormat::BGRA8);
</ins><span class="cx">
</span><span class="cx"> constexpr unsigned bytesPerPixel = 4;
</span><span class="cx">
</span><span class="lines">@@ -41,21 +41,21 @@
</span><span class="cx"> return size.area<RecordOverflow>() * bytesPerPixel;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Optional<PixelBuffer> PixelBuffer::tryCreateForDecoding(DestinationColorSpace colorSpace, PixelFormat format, const IntSize& size, unsigned dataByteLength)
</del><ins>+Optional<PixelBuffer> PixelBuffer::tryCreateForDecoding(const PixelBufferFormat& format, const IntSize& size, unsigned dataByteLength)
</ins><span class="cx"> {
</span><del>- ASSERT(format == PixelFormat::RGBA8 || format == PixelFormat::BGRA8);
</del><ins>+ ASSERT(format.pixelFormat == PixelFormat::RGBA8 || format.pixelFormat == PixelFormat::BGRA8);
</ins><span class="cx"> ASSERT(computeBufferSize(format, size).unsafeGet() == dataByteLength);
</span><span class="cx">
</span><span class="cx"> auto pixelArray = Uint8ClampedArray::tryCreateUninitialized(dataByteLength);
</span><span class="cx"> if (!pixelArray)
</span><span class="cx"> return WTF::nullopt;
</span><del>- return { { colorSpace, format, size, pixelArray.releaseNonNull() } };
</del><ins>+ return { { format, size, pixelArray.releaseNonNull() } };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-Optional<PixelBuffer> PixelBuffer::tryCreate(DestinationColorSpace colorSpace, PixelFormat format, const IntSize& size)
</del><ins>+Optional<PixelBuffer> PixelBuffer::tryCreate(const PixelBufferFormat& format, const IntSize& size)
</ins><span class="cx"> {
</span><span class="cx"> // NOTE: Only 8-bit formats are currently supported.
</span><del>- ASSERT(format == PixelFormat::RGBA8 || format == PixelFormat::BGRA8);
</del><ins>+ ASSERT(format.pixelFormat == PixelFormat::RGBA8 || format.pixelFormat == PixelFormat::BGRA8);
</ins><span class="cx">
</span><span class="cx"> auto bufferSize = computeBufferSize(format, size);
</span><span class="cx"> if (bufferSize.hasOverflowed())
</span><span class="lines">@@ -63,12 +63,11 @@
</span><span class="cx"> auto pixelArray = Uint8ClampedArray::tryCreateUninitialized(bufferSize.unsafeGet());
</span><span class="cx"> if (!pixelArray)
</span><span class="cx"> return WTF::nullopt;
</span><del>- return { { colorSpace, format, size, pixelArray.releaseNonNull() } };
</del><ins>+ return { { format, size, pixelArray.releaseNonNull() } };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-PixelBuffer::PixelBuffer(DestinationColorSpace colorSpace, PixelFormat format, const IntSize& size, Ref<JSC::Uint8ClampedArray>&& data)
- : m_colorSpace { colorSpace }
- , m_format { format }
</del><ins>+PixelBuffer::PixelBuffer(const PixelBufferFormat& format, const IntSize& size, Ref<JSC::Uint8ClampedArray>&& data)
+ : m_format { format }
</ins><span class="cx"> , m_size { size }
</span><span class="cx"> , m_data { WTFMove(data) }
</span><span class="cx"> {
</span><span class="lines">@@ -79,12 +78,12 @@
</span><span class="cx">
</span><span class="cx"> PixelBuffer PixelBuffer::deepClone() const
</span><span class="cx"> {
</span><del>- return { m_colorSpace, m_format, m_size, Uint8ClampedArray::create(m_data->data(), m_data->length()) };
</del><ins>+ return { m_format, m_size, Uint8ClampedArray::create(m_data->data(), m_data->length()) };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TextStream& operator<<(TextStream& ts, const PixelBuffer& pixelBuffer)
</span><span class="cx"> {
</span><del>- return ts << &pixelBuffer.data();
</del><ins>+ return ts << &pixelBuffer.data() << "format ( " << pixelBuffer.format() << ")";
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPixelBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/PixelBuffer.h (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/PixelBuffer.h 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/PixelBuffer.h 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -25,8 +25,10 @@
</span><span class="cx">
</span><span class="cx"> #pragma once
</span><span class="cx">
</span><ins>+#include "AlphaPremultiplication.h"
</ins><span class="cx"> #include "ColorSpace.h"
</span><span class="cx"> #include "IntSize.h"
</span><ins>+#include "PixelBufferFormat.h"
</ins><span class="cx"> #include "PixelFormat.h"
</span><span class="cx"> #include <JavaScriptCore/Uint8ClampedArray.h>
</span><span class="cx">
</span><span class="lines">@@ -39,16 +41,15 @@
</span><span class="cx"> class PixelBuffer {
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(PixelBuffer);
</span><span class="cx"> public:
</span><del>- WEBCORE_EXPORT static Optional<PixelBuffer> tryCreate(DestinationColorSpace, PixelFormat, const IntSize&);
</del><ins>+ WEBCORE_EXPORT static Optional<PixelBuffer> tryCreate(const PixelBufferFormat&, const IntSize&);
</ins><span class="cx">
</span><del>- PixelBuffer(DestinationColorSpace, PixelFormat, const IntSize&, Ref<JSC::Uint8ClampedArray>&&);
</del><ins>+ PixelBuffer(const PixelBufferFormat&, const IntSize&, Ref<JSC::Uint8ClampedArray>&&);
</ins><span class="cx"> WEBCORE_EXPORT ~PixelBuffer();
</span><span class="cx">
</span><span class="cx"> PixelBuffer(PixelBuffer&&) = default;
</span><span class="cx"> PixelBuffer& operator=(PixelBuffer&&) = default;
</span><span class="cx">
</span><del>- DestinationColorSpace colorSpace() const { return m_colorSpace; }
- PixelFormat format() const { return m_format; }
</del><ins>+ const PixelBufferFormat& format() const { return m_format; }
</ins><span class="cx"> const IntSize& size() const { return m_size; }
</span><span class="cx"> JSC::Uint8ClampedArray& data() const { return m_data.get(); }
</span><span class="cx">
</span><span class="lines">@@ -58,12 +59,11 @@
</span><span class="cx"> template<class Decoder> static Optional<PixelBuffer> decode(Decoder&);
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- WEBCORE_EXPORT static Optional<PixelBuffer> tryCreateForDecoding(DestinationColorSpace, PixelFormat, const IntSize&, unsigned dataByteLength);
</del><ins>+ WEBCORE_EXPORT static Optional<PixelBuffer> tryCreateForDecoding(const PixelBufferFormat&, const IntSize&, unsigned dataByteLength);
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT static Checked<unsigned, RecordOverflow> computeBufferSize(PixelFormat, const IntSize&);
</del><ins>+ WEBCORE_EXPORT static Checked<unsigned, RecordOverflow> computeBufferSize(const PixelBufferFormat&, const IntSize&);
</ins><span class="cx">
</span><del>- DestinationColorSpace m_colorSpace;
- PixelFormat m_format;
</del><ins>+ PixelBufferFormat m_format;
</ins><span class="cx"> IntSize m_size;
</span><span class="cx"> Ref<JSC::Uint8ClampedArray> m_data;
</span><span class="cx"> };
</span><span class="lines">@@ -74,7 +74,6 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_data->byteLength() == (m_size.area().unsafeGet() * 4));
</span><span class="cx">
</span><del>- encoder << m_colorSpace;
</del><span class="cx"> encoder << m_format;
</span><span class="cx"> encoder << m_size;
</span><span class="cx"> encoder.encodeFixedLengthData(m_data->data(), m_data->byteLength(), 1);
</span><span class="lines">@@ -82,16 +81,12 @@
</span><span class="cx">
</span><span class="cx"> template<class Decoder> Optional<PixelBuffer> PixelBuffer::decode(Decoder& decoder)
</span><span class="cx"> {
</span><del>- DestinationColorSpace colorSpace;
- if (!decoder.decode(colorSpace))
- return WTF::nullopt;
-
- PixelFormat format;
</del><ins>+ PixelBufferFormat format;
</ins><span class="cx"> if (!decoder.decode(format))
</span><span class="cx"> return WTF::nullopt;
</span><span class="cx">
</span><span class="cx"> // FIXME: Support non-8 bit formats.
</span><del>- if (!(format == PixelFormat::RGBA8 || format == PixelFormat::BGRA8))
</del><ins>+ if (!(format.pixelFormat == PixelFormat::RGBA8 || format.pixelFormat == PixelFormat::BGRA8))
</ins><span class="cx"> return WTF::nullopt;
</span><span class="cx">
</span><span class="cx"> IntSize size;
</span><span class="lines">@@ -106,7 +101,7 @@
</span><span class="cx"> if (!decoder.template bufferIsLargeEnoughToContain<uint8_t>(bufferSize))
</span><span class="cx"> return WTF::nullopt;
</span><span class="cx">
</span><del>- auto result = PixelBuffer::tryCreateForDecoding(colorSpace, format, size, bufferSize);
</del><ins>+ auto result = PixelBuffer::tryCreateForDecoding(format, size, bufferSize);
</ins><span class="cx"> if (!result)
</span><span class="cx"> return WTF::nullopt;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPixelBufferConversioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/PixelBufferConversion.cpp (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/PixelBufferConversion.cpp 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/PixelBufferConversion.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -56,14 +56,14 @@
</span><span class="cx"> auto sourceVImageBuffer = makeVImageBuffer(source, destinationSize);
</span><span class="cx"> auto destinationVImageBuffer = makeVImageBuffer(destination, destinationSize);
</span><span class="cx">
</span><del>- if (source.alphaFormat != destination.alphaFormat) {
- if (destination.alphaFormat == AlphaPremultiplication::Unpremultiplied) {
- if (source.pixelFormat == PixelFormat::RGBA8)
</del><ins>+ if (source.format.alphaFormat != destination.format.alphaFormat) {
+ if (destination.format.alphaFormat == AlphaPremultiplication::Unpremultiplied) {
+ if (source.format.pixelFormat == PixelFormat::RGBA8)
</ins><span class="cx"> vImageUnpremultiplyData_RGBA8888(&sourceVImageBuffer, &destinationVImageBuffer, kvImageNoFlags);
</span><span class="cx"> else
</span><span class="cx"> vImageUnpremultiplyData_BGRA8888(&sourceVImageBuffer, &destinationVImageBuffer, kvImageNoFlags);
</span><span class="cx"> } else {
</span><del>- if (source.pixelFormat == PixelFormat::RGBA8)
</del><ins>+ if (source.format.pixelFormat == PixelFormat::RGBA8)
</ins><span class="cx"> vImagePremultiplyData_RGBA8888(&sourceVImageBuffer, &destinationVImageBuffer, kvImageNoFlags);
</span><span class="cx"> else
</span><span class="cx"> vImagePremultiplyData_BGRA8888(&sourceVImageBuffer, &destinationVImageBuffer, kvImageNoFlags);
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx"> sourceVImageBuffer = destinationVImageBuffer;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (source.pixelFormat != destination.pixelFormat) {
</del><ins>+ if (source.format.pixelFormat != destination.format.pixelFormat) {
</ins><span class="cx"> // Swap pixel channels BGRA <-> RGBA.
</span><span class="cx"> const uint8_t map[4] = { 2, 1, 0, 3 };
</span><span class="cx"> vImagePermuteChannels_ARGB8888(&sourceVImageBuffer, &destinationVImageBuffer, map, kvImageNoFlags);
</span><span class="lines">@@ -181,16 +181,16 @@
</span><span class="cx"> void convertImagePixels(const ConstPixelBufferConversionView& source, const PixelBufferConversionView& destination, const IntSize& destinationSize)
</span><span class="cx"> {
</span><span class="cx"> // We don't currently support converting pixel data with non-8-bit buffers.
</span><del>- ASSERT(source.pixelFormat == PixelFormat::RGBA8 || source.pixelFormat == PixelFormat::BGRA8);
- ASSERT(destination.pixelFormat == PixelFormat::RGBA8 || destination.pixelFormat == PixelFormat::BGRA8);
</del><ins>+ ASSERT(source.format.pixelFormat == PixelFormat::RGBA8 || source.format.pixelFormat == PixelFormat::BGRA8);
+ ASSERT(destination.format.pixelFormat == PixelFormat::RGBA8 || destination.format.pixelFormat == PixelFormat::BGRA8);
</ins><span class="cx">
</span><span class="cx"> // We don't currently support converting pixel data between different color spaces.
</span><del>- ASSERT(source.colorSpace == destination.colorSpace);
</del><ins>+ ASSERT(source.format.colorSpace == destination.format.colorSpace);
</ins><span class="cx">
</span><span class="cx"> #if USE(ACCELERATE)
</span><del>- if (source.alphaFormat == destination.alphaFormat && source.pixelFormat == destination.pixelFormat) {
</del><ins>+ if (source.format.alphaFormat == destination.format.alphaFormat && source.format.pixelFormat == destination.format.pixelFormat) {
</ins><span class="cx"> // FIXME: Can thes both just use per-row memcpy?
</span><del>- if (source.alphaFormat == AlphaPremultiplication::Premultiplied)
</del><ins>+ if (source.format.alphaFormat == AlphaPremultiplication::Premultiplied)
</ins><span class="cx"> convertImagePixelsUnaccelerated<convertSinglePixelPremultipliedToPremultiplied<PixelFormatConversion::None>>(source, destination, destinationSize);
</span><span class="cx"> else
</span><span class="cx"> convertImagePixelsUnaccelerated<convertSinglePixelUnpremultipliedToUnpremultiplied<PixelFormatConversion::None>>(source, destination, destinationSize);
</span><span class="lines">@@ -197,29 +197,29 @@
</span><span class="cx"> } else
</span><span class="cx"> convertImagePixelsAccelerated(source, destination, destinationSize);
</span><span class="cx"> #else
</span><del>- if (source.alphaFormat == destination.alphaFormat) {
- if (source.pixelFormat == destination.pixelFormat) {
- if (source.alphaFormat == AlphaPremultiplication::Premultiplied)
</del><ins>+ if (source.format.alphaFormat == destination.format.alphaFormat) {
+ if (source.format.pixelFormat == destination.format.pixelFormat) {
+ if (source.format.alphaFormat == AlphaPremultiplication::Premultiplied)
</ins><span class="cx"> convertImagePixelsUnaccelerated<convertSinglePixelPremultipliedToPremultiplied<PixelFormatConversion::None>>(source, destination, destinationSize);
</span><span class="cx"> else
</span><span class="cx"> convertImagePixelsUnaccelerated<convertSinglePixelUnpremultipliedToUnpremultiplied<PixelFormatConversion::None>>(source, destination, destinationSize);
</span><span class="cx"> } else {
</span><del>- if (destination.alphaFormat == AlphaPremultiplication::Premultiplied)
</del><ins>+ if (destination.format.alphaFormat == AlphaPremultiplication::Premultiplied)
</ins><span class="cx"> convertImagePixelsUnaccelerated<convertSinglePixelPremultipliedToPremultiplied<PixelFormatConversion::Permute>>(source, destination, destinationSize);
</span><span class="cx"> else
</span><span class="cx"> convertImagePixelsUnaccelerated<convertSinglePixelUnpremultipliedToUnpremultiplied<PixelFormatConversion::Permute>>(source, destination, destinationSize);
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><del>- if (source.pixelFormat == destination.pixelFormat) {
- if (source.alphaFormat == AlphaPremultiplication::Premultiplied)
</del><ins>+ if (source.format.pixelFormat == destination.format.pixelFormat) {
+ if (source.format.alphaFormat == AlphaPremultiplication::Premultiplied)
</ins><span class="cx"> convertImagePixelsUnaccelerated<convertSinglePixelPremultipliedToUnpremultiplied<PixelFormatConversion::None>>(source, destination, destinationSize);
</span><span class="cx"> else
</span><span class="cx"> convertImagePixelsUnaccelerated<convertSinglePixelUnpremultipliedToPremultiplied<PixelFormatConversion::None>>(source, destination, destinationSize);
</span><span class="cx"> } else {
</span><del>- if (destination.alphaFormat == AlphaPremultiplication::Unpremultiplied)
</del><ins>+ if (destination.format.alphaFormat == AlphaPremultiplication::Premultiplied)
+ convertImagePixelsUnaccelerated<convertSinglePixelUnpremultipliedToPremultiplied<PixelFormatConversion::Permute>>(source, destination, destinationSize);
+ else
</ins><span class="cx"> convertImagePixelsUnaccelerated<convertSinglePixelPremultipliedToUnpremultiplied<PixelFormatConversion::Permute>>(source, destination, destinationSize);
</span><del>- else
- convertImagePixelsUnaccelerated<convertSinglePixelUnpremultipliedToPremultiplied<PixelFormatConversion::Permute>>(source, destination, destinationSize);
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPixelBufferConversionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/PixelBufferConversion.h (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/PixelBufferConversion.h 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/PixelBufferConversion.h 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -25,26 +25,20 @@
</span><span class="cx">
</span><span class="cx"> #pragma once
</span><span class="cx">
</span><ins>+#include "PixelBufferFormat.h"
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class IntSize;
</span><span class="cx">
</span><del>-enum class AlphaPremultiplication : uint8_t;
-enum class DestinationColorSpace : uint8_t;
-enum class PixelFormat : uint8_t;
-
</del><span class="cx"> struct PixelBufferConversionView {
</span><del>- AlphaPremultiplication alphaFormat;
- DestinationColorSpace colorSpace;
- PixelFormat pixelFormat;
</del><ins>+ PixelBufferFormat format;
</ins><span class="cx"> unsigned bytesPerRow;
</span><span class="cx"> uint8_t* rows;
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> struct ConstPixelBufferConversionView {
</span><del>- AlphaPremultiplication alphaFormat;
- DestinationColorSpace colorSpace;
- PixelFormat pixelFormat;
</del><ins>+ PixelBufferFormat format;
</ins><span class="cx"> unsigned bytesPerRow;
</span><span class="cx"> const uint8_t* rows;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPixelBufferFormatcppfromrev277449trunkSourceWebCoreplatformgraphicsPixelFormath"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/PixelBufferFormat.cpp (from rev 277449, trunk/Source/WebCore/platform/graphics/PixelFormat.h) (0 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/PixelBufferFormat.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/PixelBufferFormat.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PixelBufferFormat.h"
+
+#include <wtf/text/TextStream.h>
+
+namespace WebCore {
+
+TextStream& operator<<(TextStream& ts, const PixelBufferFormat& pixelBuffer)
+{
+ return ts << pixelBuffer.alphaFormat << ' ' << pixelBuffer.pixelFormat << ' ' << pixelBuffer.colorSpace;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPixelBufferFormathfromrev277449trunkSourceWebCoreplatformgraphicsPixelBufferConversionh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/PixelBufferFormat.h (from rev 277449, trunk/Source/WebCore/platform/graphics/PixelBufferConversion.h) (0 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/PixelBufferFormat.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/PixelBufferFormat.h 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "AlphaPremultiplication.h"
+#include "ColorSpace.h"
+#include "PixelFormat.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+struct PixelBufferFormat {
+ AlphaPremultiplication alphaFormat;
+ PixelFormat pixelFormat;
+ DestinationColorSpace colorSpace;
+
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<PixelBufferFormat> decode(Decoder&);
+};
+
+WEBCORE_EXPORT TextStream& operator<<(TextStream&, const PixelBufferFormat&);
+
+template<class Encoder> void PixelBufferFormat::encode(Encoder& encoder) const
+{
+ encoder << alphaFormat << pixelFormat << colorSpace;
+}
+
+template<class Decoder> Optional<PixelBufferFormat> PixelBufferFormat::decode(Decoder& decoder)
+{
+ AlphaPremultiplication alphaFormat;
+ if (!decoder.decode(alphaFormat))
+ return WTF::nullopt;
+
+ PixelFormat pixelFormat;
+ if (!decoder.decode(pixelFormat))
+ return WTF::nullopt;
+
+ DestinationColorSpace colorSpace;
+ if (!decoder.decode(colorSpace))
+ return WTF::nullopt;
+
+ return { { alphaFormat, pixelFormat, colorSpace } };
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPixelFormatcppfromrev277449trunkSourceWebCoreplatformgraphicsPixelFormath"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/PixelFormat.cpp (from rev 277449, trunk/Source/WebCore/platform/graphics/PixelFormat.h) (0 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/PixelFormat.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/PixelFormat.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PixelFormat.h"
+
+#include <wtf/text/TextStream.h>
+
+namespace WebCore {
+
+TextStream& operator<<(TextStream& ts, PixelFormat pixelFormat)
+{
+ switch (pixelFormat) {
+ case PixelFormat::RGBA8:
+ ts << "RGBA8";
+ break;
+ case PixelFormat::BGRA8:
+ ts << "BGRA8";
+ break;
+ case PixelFormat::RGB10:
+ ts << "RGB10";
+ break;
+ case PixelFormat::RGB10A8:
+ ts << "RGB10A8";
+ break;
+ }
+ return ts;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPixelFormath"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/PixelFormat.h (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/PixelFormat.h 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/PixelFormat.h 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #pragma once
</span><span class="cx">
</span><span class="cx"> #include <wtf/EnumTraits.h>
</span><ins>+#include <wtf/Forward.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -36,6 +37,8 @@
</span><span class="cx"> RGB10A8,
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+WEBCORE_EXPORT TextStream& operator<<(TextStream&, PixelFormat);
+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace WTF {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsangleGraphicsContextGLANGLEcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -79,7 +79,8 @@
</span><span class="cx">
</span><span class="cx"> Optional<PixelBuffer> GraphicsContextGLOpenGL::readPixelsForPaintResults()
</span><span class="cx"> {
</span><del>- auto pixelBuffer = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat::RGBA8, getInternalFramebufferSize());
</del><ins>+ PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
+ auto pixelBuffer = PixelBuffer::tryCreate(format, getInternalFramebufferSize());
</ins><span class="cx"> if (!pixelBuffer)
</span><span class="cx"> return WTF::nullopt;
</span><span class="cx"> ScopedPixelStorageMode packAlignment(GL_PACK_ALIGNMENT);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgGraphicsContextGLCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextGLCG.cpp (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextGLCG.cpp 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextGLCG.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -532,7 +532,7 @@
</span><span class="cx"> }));
</span><span class="cx">
</span><span class="cx"> auto imageSize = pixelBuffer.size();
</span><del>- auto image = NativeImage::create(adoptCF(CGImageCreate(imageSize.width(), imageSize.height(), 8, 32, 4 * imageSize.width(), cachedCGColorSpace(pixelBuffer.colorSpace()), bitmapInfo, dataProvider.get(), 0, false, kCGRenderingIntentDefault)));
</del><ins>+ auto image = NativeImage::create(adoptCF(CGImageCreate(imageSize.width(), imageSize.height(), 8, 32, 4 * imageSize.width(), cachedCGColorSpace(pixelBuffer.format().colorSpace), bitmapInfo, dataProvider.get(), 0, false, kCGRenderingIntentDefault)));
</ins><span class="cx">
</span><span class="cx"> // CSS styling may cause the canvas's content to be resized on
</span><span class="cx"> // the page. Go back to the Canvas to figure out the correct
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgImageBufferCGBackendcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -201,7 +201,7 @@
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> auto imageSize = pixelBuffer->size();
</span><del>- image = adoptCF(CGImageCreate(imageSize.width(), imageSize.height(), 8, 32, 4 * imageSize.width(), cachedCGColorSpace(pixelBuffer->colorSpace()), kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
</del><ins>+ image = adoptCF(CGImageCreate(imageSize.width(), imageSize.height(), 8, 32, 4 * imageSize.width(), cachedCGColorSpace(pixelBuffer->format().colorSpace), kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
</ins><span class="cx"> } else if (resolutionScale() == 1 || preserveResolution == PreserveResolution::Yes) {
</span><span class="cx"> auto nativeImage = copyNativeImage(CopyBackingStore);
</span><span class="cx"> if (!nativeImage)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgImageBufferUtilitiesCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferUtilitiesCG.cpp (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferUtilitiesCG.cpp 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferUtilitiesCG.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -163,7 +163,7 @@
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> auto imageSize = source.size();
</span><del>- auto image = adoptCF(CGImageCreate(imageSize.width(), imageSize.height(), 8, 32, 4 * imageSize.width(), cachedCGColorSpace(source.colorSpace()), kCGBitmapByteOrderDefault | dataAlphaInfo, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
</del><ins>+ auto image = adoptCF(CGImageCreate(imageSize.width(), imageSize.height(), 8, 32, 4 * imageSize.width(), cachedCGColorSpace(source.format().colorSpace), kCGBitmapByteOrderDefault | dataAlphaInfo, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
</ins><span class="cx">
</span><span class="cx"> auto cfData = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, 0));
</span><span class="cx"> if (!encodeImage(image.get(), uti.get(), quality, cfData.get()))
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterEffectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -505,7 +505,8 @@
</span><span class="cx"> IntSize inputSize(m_absolutePaintRect.size());
</span><span class="cx"> ASSERT(!ImageBuffer::sizeNeedsClamping(inputSize));
</span><span class="cx"> inputSize.scale(m_filter.filterScale());
</span><del>- m_unmultipliedImageResult = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat::RGBA8, inputSize);
</del><ins>+ PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
+ m_unmultipliedImageResult = PixelBuffer::tryCreate(format, inputSize);
</ins><span class="cx"> if (!m_unmultipliedImageResult)
</span><span class="cx"> return;
</span><span class="cx"> copyUnpremultiplyingAlpha(m_premultipliedImageResult->data(), m_unmultipliedImageResult->data(), inputSize);
</span><span class="lines">@@ -538,7 +539,8 @@
</span><span class="cx"> IntSize inputSize(m_absolutePaintRect.size());
</span><span class="cx"> ASSERT(!ImageBuffer::sizeNeedsClamping(inputSize));
</span><span class="cx"> inputSize.scale(m_filter.filterScale());
</span><del>- m_premultipliedImageResult = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat::RGBA8, inputSize);
</del><ins>+ PixelBufferFormat format { AlphaPremultiplication::Premultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
+ m_premultipliedImageResult = PixelBuffer::tryCreate(format, inputSize);
</ins><span class="cx"> if (!m_premultipliedImageResult)
</span><span class="cx"> return;
</span><span class="cx"> copyPremultiplyingAlpha(m_unmultipliedImageResult->data(), m_premultipliedImageResult->data(), inputSize);
</span><span class="lines">@@ -580,7 +582,8 @@
</span><span class="cx"> IntSize resultSize(m_absolutePaintRect.size());
</span><span class="cx"> ASSERT(!ImageBuffer::sizeNeedsClamping(resultSize));
</span><span class="cx"> resultSize.scale(m_filter.filterScale());
</span><del>- m_unmultipliedImageResult = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat::RGBA8, resultSize);
</del><ins>+ PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
+ m_unmultipliedImageResult = PixelBuffer::tryCreate(format, resultSize);
</ins><span class="cx"> return m_unmultipliedImageResult;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -598,7 +601,8 @@
</span><span class="cx"> IntSize resultSize(m_absolutePaintRect.size());
</span><span class="cx"> ASSERT(!ImageBuffer::sizeNeedsClamping(resultSize));
</span><span class="cx"> resultSize.scale(m_filter.filterScale());
</span><del>- m_premultipliedImageResult = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat::RGBA8, resultSize);
</del><ins>+ PixelBufferFormat format { AlphaPremultiplication::Premultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
+ m_premultipliedImageResult = PixelBuffer::tryCreate(format, resultSize);
</ins><span class="cx"> return m_premultipliedImageResult;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGraphicsContextGLOpenGLBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -63,7 +63,8 @@
</span><span class="cx">
</span><span class="cx"> Optional<PixelBuffer> GraphicsContextGLOpenGL::readPixelsForPaintResults()
</span><span class="cx"> {
</span><del>- auto pixelBuffer = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat::RGBA8, getInternalFramebufferSize());
</del><ins>+ PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
+ auto pixelBuffer = PixelBuffer::tryCreate(format, getInternalFramebufferSize());
</ins><span class="cx"> if (!pixelBuffer)
</span><span class="cx"> return WTF::nullopt;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGraphicsContextGLOpenGLEScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -66,7 +66,8 @@
</span><span class="cx">
</span><span class="cx"> Optional<PixelBuffer> GraphicsContextGLOpenGL::readPixelsForPaintResults()
</span><span class="cx"> {
</span><del>- auto pixelBuffer = PixelBuffer::tryCreate(DestinationColorSpace::SRGB, PixelFormat::RGBA8, getInternalFramebufferSize());
</del><ins>+ PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB };
+ auto pixelBuffer = PixelBuffer::tryCreate(format, getInternalFramebufferSize());
</ins><span class="cx"> if (!pixelBuffer)
</span><span class="cx"> return WTF::nullopt;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebKit/ChangeLog 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2021-05-13 Sam Weinig <weinig@apple.com>
+
+ Split pixel buffer format data out into a new PixelBufferFormat struct
+ https://bugs.webkit.org/show_bug.cgi?id=225707
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
+ Adopt PixelBufferFormat.
+
</ins><span class="cx"> 2021-05-13 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Rename FileSystem::directoryName() to FileSystem::parentPath()
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUgraphicsRemoteImageBufferProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h (277449 => 277450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h 2021-05-13 20:47:38 UTC (rev 277449)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h 2021-05-13 20:54:21 UTC (rev 277450)
</span><span class="lines">@@ -199,7 +199,8 @@
</span><span class="cx"> if (UNLIKELY(!m_remoteRenderingBackendProxy))
</span><span class="cx"> return WTF::nullopt;
</span><span class="cx">
</span><del>- auto pixelBuffer = WebCore::PixelBuffer::tryCreate(WebCore::DestinationColorSpace::SRGB, WebCore::PixelFormat::RGBA8, srcRect.size());
</del><ins>+ WebCore::PixelBufferFormat destinationFormat { outputFormat, WebCore::PixelFormat::RGBA8, WebCore::DestinationColorSpace::SRGB };
+ auto pixelBuffer = WebCore::PixelBuffer::tryCreate(destinationFormat, srcRect.size());
</ins><span class="cx"> if (!pixelBuffer)
</span><span class="cx"> return WTF::nullopt;
</span><span class="cx"> size_t dataSize = pixelBuffer->data().byteLength();
</span></span></pre>
</div>
</div>
</body>
</html>