Diff
Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (295112 => 295113)
--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -3394,7 +3394,7 @@
return JSValue();
}
- buffer->putPixelBuffer(WTFMove(*pixelBuffer), { IntPoint::zero(), logicalSize });
+ buffer->putPixelBuffer(*pixelBuffer, { IntPoint::zero(), logicalSize });
auto bitmap = ImageBitmap::create(ImageBitmapBacking(WTFMove(buffer), OptionSet<SerializationState>::fromRaw(serializationState)));
return getJSValue(bitmap);
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (295112 => 295113)
--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -800,9 +800,9 @@
return nullptr;
#if PLATFORM(COCOA)
- return VideoFrameCV::createFromPixelBuffer(WTFMove(*pixelBuffer));
+ return VideoFrameCV::createFromPixelBuffer(pixelBuffer.releaseNonNull());
#elif USE(GSTREAMER)
- return VideoFrameGStreamer::createFromPixelBuffer(WTFMove(*pixelBuffer));
+ return VideoFrameGStreamer::createFromPixelBuffer(pixelBuffer.releaseNonNull());
#endif
#else
return nullptr;
Modified: trunk/Source/WebCore/html/ImageData.cpp (295112 => 295113)
--- trunk/Source/WebCore/html/ImageData.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/html/ImageData.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -50,17 +50,17 @@
return defaultColorSpace;
}
-Ref<ImageData> ImageData::create(PixelBuffer&& pixelBuffer)
+Ref<ImageData> ImageData::create(Ref<PixelBuffer>&& pixelBuffer)
{
- auto colorSpace = toPredefinedColorSpace(pixelBuffer.format().colorSpace);
- return adoptRef(*new ImageData(pixelBuffer.size(), pixelBuffer.takeData(), *colorSpace));
+ auto colorSpace = toPredefinedColorSpace(pixelBuffer->format().colorSpace);
+ return adoptRef(*new ImageData(pixelBuffer->size(), pixelBuffer->takeData(), *colorSpace));
}
-RefPtr<ImageData> ImageData::create(std::optional<PixelBuffer>&& pixelBuffer)
+RefPtr<ImageData> ImageData::create(RefPtr<PixelBuffer>&& pixelBuffer)
{
if (!pixelBuffer)
return nullptr;
- return create(WTFMove(*pixelBuffer));
+ return create(pixelBuffer.releaseNonNull());
}
RefPtr<ImageData> ImageData::create(const IntSize& size)
@@ -153,10 +153,10 @@
ImageData::~ImageData() = default;
-PixelBuffer ImageData::pixelBuffer() const
+Ref<PixelBuffer> ImageData::pixelBuffer() const
{
PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, toDestinationColorSpace(m_colorSpace) };
- return { format, m_size, m_data.get() };
+ return PixelBuffer::create(format, m_size, m_data.get());
}
TextStream& operator<<(TextStream& ts, const ImageData& imageData)
Modified: trunk/Source/WebCore/html/ImageData.h (295112 => 295113)
--- trunk/Source/WebCore/html/ImageData.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/html/ImageData.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -40,8 +40,8 @@
class ImageData : public RefCounted<ImageData> {
public:
- WEBCORE_EXPORT static Ref<ImageData> create(PixelBuffer&&);
- WEBCORE_EXPORT static RefPtr<ImageData> create(std::optional<PixelBuffer>&&);
+ WEBCORE_EXPORT static Ref<ImageData> create(Ref<PixelBuffer>&&);
+ WEBCORE_EXPORT static RefPtr<ImageData> create(RefPtr<PixelBuffer>&&);
WEBCORE_EXPORT static RefPtr<ImageData> create(const IntSize&);
WEBCORE_EXPORT static RefPtr<ImageData> create(const IntSize&, Ref<Uint8ClampedArray>&&, PredefinedColorSpace);
WEBCORE_EXPORT static ExceptionOr<Ref<ImageData>> createUninitialized(unsigned rows, unsigned pixelsPerRow, PredefinedColorSpace defaultColorSpace, std::optional<ImageDataSettings> = std::nullopt);
@@ -59,7 +59,7 @@
Uint8ClampedArray& data() const { return m_data.get(); }
PredefinedColorSpace colorSpace() const { return m_colorSpace; }
- PixelBuffer pixelBuffer() const;
+ Ref<PixelBuffer> pixelBuffer() const;
private:
explicit ImageData(const IntSize&, Ref<JSC::Uint8ClampedArray>&&, PredefinedColorSpace);
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (295112 => 295113)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -2196,7 +2196,7 @@
ASSERT(pixelBuffer->format().colorSpace == toDestinationColorSpace(computedColorSpace));
- return { { ImageData::create(WTFMove(*pixelBuffer)) } };
+ return { { ImageData::create(pixelBuffer.releaseNonNull()) } };
}
void CanvasRenderingContext2DBase::putImageData(ImageData& data, int dx, int dy)
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (295112 => 295113)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -1460,10 +1460,10 @@
}
}
-std::optional<PixelBuffer> WebGLRenderingContextBase::paintRenderingResultsToPixelBuffer()
+RefPtr<PixelBuffer> WebGLRenderingContextBase::paintRenderingResultsToPixelBuffer()
{
if (isContextLostOrPending())
- return std::nullopt;
+ return nullptr;
clearIfComposited(ClearCallerOther);
return m_context->paintRenderingResultsToPixelBuffer();
}
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (295112 => 295113)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -396,7 +396,7 @@
void prepareForDisplayWithPaint() final;
void paintRenderingResultsToCanvas() final;
- std::optional<PixelBuffer> paintRenderingResultsToPixelBuffer();
+ RefPtr<PixelBuffer> paintRenderingResultsToPixelBuffer();
#if ENABLE(MEDIA_STREAM)
RefPtr<VideoFrame> paintCompositedResultsToVideoFrame();
#endif
Modified: trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -266,13 +266,13 @@
return { };
}
- std::optional<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const override
+ RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const override
{
if (auto* backend = ensureBackendCreated()) {
const_cast<ConcreteImageBuffer&>(*this).flushContext();
return backend->getPixelBuffer(outputFormat, srcRect);
}
- return std::nullopt;
+ return nullptr;
}
void putPixelBuffer(const PixelBuffer& pixelBuffer, const IntRect& srcRect, const IntPoint& destPoint = { }, AlphaPremultiplication destFormat = AlphaPremultiplication::Premultiplied) override
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -1443,7 +1443,7 @@
// display buffer abstractions that the caller should hold separate to
// the context.
virtual void paintRenderingResultsToCanvas(ImageBuffer&) = 0;
- virtual std::optional<PixelBuffer> paintRenderingResultsToPixelBuffer() = 0;
+ virtual RefPtr<PixelBuffer> paintRenderingResultsToPixelBuffer() = 0;
virtual void paintCompositedResultsToCanvas(ImageBuffer&) = 0;
#if ENABLE(MEDIA_STREAM)
virtual RefPtr<VideoFrame> paintCompositedResultsToVideoFrame() = 0;
@@ -1510,7 +1510,7 @@
// Returns true upon success.
static bool packImageData(Image*, const void* pixels, GCGLenum format, GCGLenum type, bool flipY, AlphaOp, DataFormat sourceFormat, unsigned sourceImageWidth, unsigned sourceImageHeight, const IntRect& sourceImageSubRectangle, int depth, unsigned sourceUnpackAlignment, int unpackImageHeight, Vector<uint8_t>& data);
- WEBCORE_EXPORT static void paintToCanvas(const GraphicsContextGLAttributes&, PixelBuffer&&, const IntSize& canvasSize, GraphicsContext&);
+ WEBCORE_EXPORT static void paintToCanvas(const GraphicsContextGLAttributes&, Ref<PixelBuffer>&&, const IntSize& canvasSize, GraphicsContext&);
protected:
WEBCORE_EXPORT void forceContextLost();
WEBCORE_EXPORT void dispatchContextChangedNotification();
Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -144,7 +144,7 @@
virtual String toDataURL(const String& mimeType, std::optional<double> quality = std::nullopt, PreserveResolution = PreserveResolution::No) const = 0;
virtual Vector<uint8_t> toData(const String& mimeType, std::optional<double> quality = std::nullopt) const = 0;
- virtual std::optional<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const = 0;
+ virtual RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const = 0;
virtual void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint = { }, AlphaPremultiplication destFormat = AlphaPremultiplication::Premultiplied) = 0;
// FIXME: current implementations of this method have the restriction that they only work
Modified: trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -89,7 +89,7 @@
putPixelBuffer(*pixelBuffer, logicalRect(), IntPoint::zero(), AlphaPremultiplication::Premultiplied);
}
-std::optional<PixelBuffer> ImageBufferBackend::getPixelBuffer(const PixelBufferFormat& destinationFormat, const IntRect& sourceRect, void* data) const
+RefPtr<PixelBuffer> ImageBufferBackend::getPixelBuffer(const PixelBufferFormat& destinationFormat, const IntRect& sourceRect, void* data) const
{
ASSERT(PixelBuffer::supportedPixelFormat(destinationFormat.pixelFormat));
@@ -97,7 +97,7 @@
auto pixelBuffer = PixelBuffer::tryCreate(destinationFormat, sourceRectScaled.size());
if (!pixelBuffer)
- return std::nullopt;
+ return nullptr;
auto sourceRectClipped = intersection(backendRect(), sourceRectScaled);
IntRect destinationRect { IntPoint::zero(), sourceRectClipped.size() };
Modified: trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -123,7 +123,7 @@
virtual String toDataURL(const String& mimeType, std::optional<double> quality, PreserveResolution) const = 0;
virtual Vector<uint8_t> toData(const String& mimeType, std::optional<double> quality) const = 0;
- virtual std::optional<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&) const = 0;
+ virtual RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&) const = 0;
virtual void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat) = 0;
virtual PlatformLayer* platformLayer() const { return nullptr; }
@@ -179,7 +179,7 @@
IntRect logicalRect() const { return IntRect(IntPoint::zero(), logicalSize()); };
IntRect backendRect() const { return IntRect(IntPoint::zero(), backendSize()); };
- WEBCORE_EXPORT std::optional<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect, void* data) const;
+ WEBCORE_EXPORT RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect, void* data) const;
WEBCORE_EXPORT void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat, void* data);
Parameters m_parameters;
Modified: trunk/Source/WebCore/platform/graphics/PixelBuffer.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/PixelBuffer.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/PixelBuffer.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -56,7 +56,7 @@
return size.area<RecordOverflow>() * bytesPerPixel;
}
-std::optional<PixelBuffer> PixelBuffer::tryCreateForDecoding(const PixelBufferFormat& format, const IntSize& size, unsigned dataByteLength)
+RefPtr<PixelBuffer> PixelBuffer::tryCreateForDecoding(const PixelBufferFormat& format, const IntSize& size, unsigned dataByteLength)
{
ASSERT(supportedPixelFormat(format.pixelFormat));
ASSERT(computeBufferSize(format, size) == dataByteLength);
@@ -63,40 +63,45 @@
auto pixelArray = Uint8ClampedArray::tryCreateUninitialized(dataByteLength);
if (!pixelArray)
- return std::nullopt;
- return { { format, size, pixelArray.releaseNonNull() } };
+ return nullptr;
+ return adoptRef(new PixelBuffer(format, size, pixelArray.releaseNonNull()));
}
-std::optional<PixelBuffer> PixelBuffer::tryCreate(const PixelBufferFormat& format, const IntSize& size)
+RefPtr<PixelBuffer> PixelBuffer::tryCreate(const PixelBufferFormat& format, const IntSize& size)
{
ASSERT(supportedPixelFormat(format.pixelFormat));
auto bufferSize = computeBufferSize(format, size);
if (bufferSize.hasOverflowed())
- return std::nullopt;
+ return nullptr;
if (bufferSize > std::numeric_limits<int32_t>::max())
- return std::nullopt;
+ return nullptr;
auto pixelArray = Uint8ClampedArray::tryCreateUninitialized(bufferSize);
if (!pixelArray)
- return std::nullopt;
- return { { format, size, pixelArray.releaseNonNull() } };
+ return nullptr;
+ return adoptRef(new PixelBuffer(format, size, pixelArray.releaseNonNull()));
}
-std::optional<PixelBuffer> PixelBuffer::tryCreate(const PixelBufferFormat& format, const IntSize& size, Ref<JSC::ArrayBuffer>&& arrayBuffer)
+RefPtr<PixelBuffer> PixelBuffer::tryCreate(const PixelBufferFormat& format, const IntSize& size, Ref<JSC::ArrayBuffer>&& arrayBuffer)
{
ASSERT(supportedPixelFormat(format.pixelFormat));
auto bufferSize = computeBufferSize(format, size);
if (bufferSize.hasOverflowed())
- return std::nullopt;
+ return nullptr;
if (bufferSize != arrayBuffer->byteLength())
- return std::nullopt;
+ return nullptr;
auto pixelArray = Uint8ClampedArray::tryCreate(WTFMove(arrayBuffer), 0, bufferSize);
if (!pixelArray)
- return std::nullopt;
- return { { format, size, pixelArray.releaseNonNull() } };
+ return nullptr;
+ return adoptRef(new PixelBuffer(format, size, pixelArray.releaseNonNull()));
}
+Ref<PixelBuffer> PixelBuffer::create(const PixelBufferFormat& format, const IntSize& size, JSC::Uint8ClampedArray& data)
+{
+ return adoptRef(*new PixelBuffer(format, size, { data }));
+}
+
PixelBuffer::PixelBuffer(const PixelBufferFormat& format, const IntSize& size, Ref<JSC::Uint8ClampedArray>&& data)
: m_format { format }
, m_size { size }
@@ -115,11 +120,6 @@
PixelBuffer::~PixelBuffer() = default;
-PixelBuffer PixelBuffer::deepClone() const
-{
- return { m_format, m_size, Uint8ClampedArray::create(m_data->data(), m_data->length()) };
-}
-
uint8_t* PixelBuffer::bytes() const
{
return m_data->data();
@@ -161,7 +161,7 @@
bytes()[index] = JSC::Uint8ClampedAdaptor::toNativeFromDouble(value);
}
-std::optional<PixelBuffer> PixelBuffer::createScratchPixelBuffer(const IntSize& size) const
+RefPtr<PixelBuffer> PixelBuffer::createScratchPixelBuffer(const IntSize& size) const
{
return PixelBuffer::tryCreate(m_format, size);
}
@@ -172,4 +172,3 @@
}
} // namespace WebCore
-
Modified: trunk/Source/WebCore/platform/graphics/PixelBuffer.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/PixelBuffer.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/PixelBuffer.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -25,12 +25,10 @@
#pragma once
-#include "AlphaPremultiplication.h"
-#include "DestinationColorSpace.h"
#include "IntSize.h"
#include "PixelBufferFormat.h"
-#include "PixelFormat.h"
#include <_javascript_Core/Uint8ClampedArray.h>
+#include <wtf/RefCounted.h>
namespace WTF {
class TextStream;
@@ -38,21 +36,17 @@
namespace WebCore {
-class PixelBuffer {
+class PixelBuffer : public RefCounted<PixelBuffer> {
WTF_MAKE_NONCOPYABLE(PixelBuffer);
public:
static bool supportedPixelFormat(PixelFormat);
- WEBCORE_EXPORT static std::optional<PixelBuffer> tryCreate(const PixelBufferFormat&, const IntSize&);
- WEBCORE_EXPORT static std::optional<PixelBuffer> tryCreate(const PixelBufferFormat&, const IntSize&, Ref<JSC::ArrayBuffer>&&);
+ WEBCORE_EXPORT static RefPtr<PixelBuffer> tryCreate(const PixelBufferFormat&, const IntSize&);
+ WEBCORE_EXPORT static RefPtr<PixelBuffer> tryCreate(const PixelBufferFormat&, const IntSize&, Ref<JSC::ArrayBuffer>&&);
+ WEBCORE_EXPORT static Ref<PixelBuffer> create(const PixelBufferFormat&, const IntSize&, JSC::Uint8ClampedArray&);
- PixelBuffer(const PixelBufferFormat&, const IntSize&, Ref<JSC::Uint8ClampedArray>&&);
- PixelBuffer(const PixelBufferFormat&, const IntSize&, JSC::Uint8ClampedArray&);
WEBCORE_EXPORT ~PixelBuffer();
- PixelBuffer(PixelBuffer&&) = default;
- PixelBuffer& operator=(PixelBuffer&&) = default;
-
const PixelBufferFormat& format() const { return m_format; }
const IntSize& size() const { return m_size; }
JSC::Uint8ClampedArray& data() const { return m_data.get(); }
@@ -59,8 +53,6 @@
Ref<JSC::Uint8ClampedArray>&& takeData() { return WTFMove(m_data); }
- PixelBuffer deepClone() const;
-
uint8_t* bytes() const;
size_t sizeInBytes() const;
@@ -71,16 +63,19 @@
uint8_t item(size_t index) const;
void set(size_t index, double value);
- std::optional<PixelBuffer> createScratchPixelBuffer(const IntSize&) const;
+ RefPtr<PixelBuffer> createScratchPixelBuffer(const IntSize&) const;
template<class Encoder> void encode(Encoder&) const;
- template<class Decoder> static std::optional<PixelBuffer> decode(Decoder&);
+ template<class Decoder> static std::optional<Ref<PixelBuffer>> decode(Decoder&);
private:
- WEBCORE_EXPORT static std::optional<PixelBuffer> tryCreateForDecoding(const PixelBufferFormat&, const IntSize&, unsigned dataByteLength);
+ WEBCORE_EXPORT static RefPtr<PixelBuffer> tryCreateForDecoding(const PixelBufferFormat&, const IntSize&, unsigned dataByteLength);
WEBCORE_EXPORT static CheckedUint32 computeBufferSize(const PixelBufferFormat&, const IntSize&);
+ PixelBuffer(const PixelBufferFormat&, const IntSize&, Ref<JSC::Uint8ClampedArray>&&);
+ PixelBuffer(const PixelBufferFormat&, const IntSize&, JSC::Uint8ClampedArray&);
+
PixelBufferFormat m_format;
IntSize m_size;
Ref<JSC::Uint8ClampedArray> m_data;
@@ -97,7 +92,7 @@
encoder.encodeFixedLengthData(m_data->data(), m_data->byteLength(), 1);
}
-template<class Decoder> std::optional<PixelBuffer> PixelBuffer::decode(Decoder& decoder)
+template<class Decoder> std::optional<Ref<PixelBuffer>> PixelBuffer::decode(Decoder& decoder)
{
std::optional<PixelBufferFormat> format;
decoder >> format;
@@ -128,7 +123,7 @@
if (!decoder.decodeFixedLengthData(result->m_data->data(), result->m_data->byteLength(), 1))
return std::nullopt;
- return result;
+ return result.releaseNonNull();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -189,12 +189,12 @@
return EGL_ReleaseThread();
}
-std::optional<PixelBuffer> GraphicsContextGLANGLE::readPixelsForPaintResults()
+RefPtr<PixelBuffer> GraphicsContextGLANGLE::readPixelsForPaintResults()
{
PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB() };
auto pixelBuffer = PixelBuffer::tryCreate(format, getInternalFramebufferSize());
if (!pixelBuffer)
- return std::nullopt;
+ return nullptr;
ScopedPixelStorageMode packAlignment(GL_PACK_ALIGNMENT);
if (packAlignment > 4)
packAlignment.pixelStore(4);
@@ -575,7 +575,7 @@
#endif
}
-std::optional<PixelBuffer> GraphicsContextGLANGLE::readRenderingResults()
+RefPtr<PixelBuffer> GraphicsContextGLANGLE::readRenderingResults()
{
ScopedRestoreReadFramebufferBinding fboBinding(m_isForWebGL2, m_state.boundReadFBO);
if (contextAttributes().antialias) {
@@ -2975,7 +2975,7 @@
auto pixelBuffer = readRenderingResults();
if (!pixelBuffer)
return;
- paintToCanvas(contextAttributes(), WTFMove(*pixelBuffer), imageBuffer.backendSize(), imageBuffer.context());
+ paintToCanvas(contextAttributes(), pixelBuffer.releaseNonNull(), imageBuffer.backendSize(), imageBuffer.context());
}
void GraphicsContextGLANGLE::paintCompositedResultsToCanvas(ImageBuffer& imageBuffer)
@@ -2987,14 +2987,14 @@
auto pixelBuffer = readCompositedResults();
if (!pixelBuffer)
return;
- paintToCanvas(contextAttributes(), WTFMove(*pixelBuffer), imageBuffer.backendSize(), imageBuffer.context());
+ paintToCanvas(contextAttributes(), pixelBuffer.releaseNonNull(), imageBuffer.backendSize(), imageBuffer.context());
}
-std::optional<PixelBuffer> GraphicsContextGLANGLE::paintRenderingResultsToPixelBuffer()
+RefPtr<PixelBuffer> GraphicsContextGLANGLE::paintRenderingResultsToPixelBuffer()
{
// Reading premultiplied alpha would involve unpremultiplying, which is lossy.
if (contextAttributes().premultipliedAlpha)
- return std::nullopt;
+ return nullptr;
auto results = readRenderingResultsForPainting();
if (results && !results->size().isEmpty()) {
ASSERT(results->format().pixelFormat == PixelFormat::RGBA8 || results->format().pixelFormat == PixelFormat::BGRA8);
@@ -3013,21 +3013,21 @@
return results;
}
-std::optional<PixelBuffer> GraphicsContextGLANGLE::readRenderingResultsForPainting()
+RefPtr<PixelBuffer> GraphicsContextGLANGLE::readRenderingResultsForPainting()
{
if (!makeContextCurrent())
- return std::nullopt;
+ return nullptr;
if (getInternalFramebufferSize().isEmpty())
- return std::nullopt;
+ return nullptr;
return readRenderingResults();
}
-std::optional<PixelBuffer> GraphicsContextGLANGLE::readCompositedResultsForPainting()
+RefPtr<PixelBuffer> GraphicsContextGLANGLE::readCompositedResultsForPainting()
{
if (!makeContextCurrent())
- return std::nullopt;
+ return nullptr;
if (getInternalFramebufferSize().isEmpty())
- return std::nullopt;
+ return nullptr;
return readCompositedResults();
}
Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -328,11 +328,11 @@
bool moveErrorsToSyntheticErrorList() final;
void simulateEventForTesting(SimulatedEventForTesting) override;
void paintRenderingResultsToCanvas(ImageBuffer&) final;
- std::optional<PixelBuffer> paintRenderingResultsToPixelBuffer() final;
+ RefPtr<PixelBuffer> paintRenderingResultsToPixelBuffer() final;
void paintCompositedResultsToCanvas(ImageBuffer&) final;
- std::optional<PixelBuffer> readRenderingResultsForPainting();
- std::optional<PixelBuffer> readCompositedResultsForPainting();
+ RefPtr<PixelBuffer> readRenderingResultsForPainting();
+ RefPtr<PixelBuffer> readCompositedResultsForPainting();
protected:
GraphicsContextGLANGLE(GraphicsContextGLAttributes);
@@ -361,9 +361,9 @@
// Did the most recent drawing operation leave the GPU in an acceptable state?
void checkGPUStatus();
- std::optional<PixelBuffer> readRenderingResults();
- std::optional<PixelBuffer> readCompositedResults();
- std::optional<PixelBuffer> readPixelsForPaintResults();
+ RefPtr<PixelBuffer> readRenderingResults();
+ RefPtr<PixelBuffer> readCompositedResults();
+ RefPtr<PixelBuffer> readPixelsForPaintResults();
bool reshapeFBOs(const IntSize&);
virtual void prepareTexture();
Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextGLCairo.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextGLCairo.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextGLCairo.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -106,15 +106,15 @@
return true;
}
-void GraphicsContextGL::paintToCanvas(const GraphicsContextGLAttributes& sourceContextAttributes, PixelBuffer&& pixelBuffer, const IntSize& canvasSize, GraphicsContext& context)
+void GraphicsContextGL::paintToCanvas(const GraphicsContextGLAttributes& sourceContextAttributes, Ref<PixelBuffer>&& pixelBuffer, const IntSize& canvasSize, GraphicsContext& context)
{
- ASSERT(!pixelBuffer.size().isEmpty());
+ ASSERT(!pixelBuffer->size().isEmpty());
if (canvasSize.isEmpty())
return;
// Convert RGBA to BGRA. BGRA is CAIRO_FORMAT_ARGB32 on little-endian architectures.
- size_t totalBytes = pixelBuffer.data().byteLength();
- uint8_t* pixels = pixelBuffer.data().data();
+ size_t totalBytes = pixelBuffer->sizeInBytes();
+ uint8_t* pixels = pixelBuffer->bytes();
for (size_t i = 0; i < totalBytes; i += 4)
std::swap(pixels[i], pixels[i + 2]);
@@ -126,10 +126,10 @@
}
}
- auto imageSize = pixelBuffer.size();
+ auto imageSize = pixelBuffer->size();
RefPtr<cairo_surface_t> imageSurface = adoptRef(cairo_image_surface_create_for_data(
- pixelBuffer.data().data(), CAIRO_FORMAT_ARGB32, imageSize.width(), imageSize.height(), imageSize.width() * 4));
+ pixelBuffer->bytes(), CAIRO_FORMAT_ARGB32, imageSize.width(), imageSize.height(), imageSize.width() * 4));
auto image = NativeImage::create(WTFMove(imageSurface));
Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -104,7 +104,7 @@
return copyNativeImage(copyBehavior);
}
-std::optional<PixelBuffer> ImageBufferCairoSurfaceBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const
+RefPtr<PixelBuffer> ImageBufferCairoSurfaceBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const
{
return ImageBufferBackend::getPixelBuffer(outputFormat, srcRect, cairo_image_surface_get_data(m_surface.get()));
}
Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -46,7 +46,7 @@
RefPtr<cairo_surface_t> createCairoSurface() override;
- std::optional<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&) const override;
+ RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&) const override;
void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat) override;
protected:
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextGLCG.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextGLCG.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextGLCG.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -506,9 +506,9 @@
return true;
}
-void GraphicsContextGL::paintToCanvas(const GraphicsContextGLAttributes& sourceContextAttributes, PixelBuffer&& pixelBuffer, const IntSize& canvasSize, GraphicsContext& context)
+void GraphicsContextGL::paintToCanvas(const GraphicsContextGLAttributes& sourceContextAttributes, Ref<PixelBuffer>&& pixelBuffer, const IntSize& canvasSize, GraphicsContext& context)
{
- ASSERT(!pixelBuffer.size().isEmpty());
+ ASSERT(!pixelBuffer->size().isEmpty());
if (canvasSize.isEmpty())
return;
// Input is GL_RGBA == kCGBitmapByteOrder32Big | kCGImageAlpha*Last.
@@ -521,7 +521,7 @@
else
bitmapInfo |= kCGImageAlphaLast;
- Ref pixelArray = pixelBuffer.data();
+ Ref pixelArray = pixelBuffer->data();
auto dataSize = pixelArray->byteLength();
auto data = ""
@@ -531,8 +531,8 @@
static_cast<JSC::Uint8ClampedArray*>(context)->deref();
}));
- auto imageSize = pixelBuffer.size();
- auto image = NativeImage::create(adoptCF(CGImageCreate(imageSize.width(), imageSize.height(), 8, 32, 4 * imageSize.width(), pixelBuffer.format().colorSpace.platformColorSpace(), bitmapInfo, dataProvider.get(), 0, false, kCGRenderingIntentDefault)));
+ auto imageSize = pixelBuffer->size();
+ auto image = NativeImage::create(adoptCF(CGImageCreate(imageSize.width(), imageSize.height(), 8, 32, 4 * imageSize.width(), pixelBuffer->format().colorSpace.platformColorSpace(), bitmapInfo, dataProvider.get(), 0, false, kCGRenderingIntentDefault)));
// CSS styling may cause the canvas's content to be resized on
// the page. Go back to the Canvas to figure out the correct
Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -155,7 +155,7 @@
return nullptr;
}
-std::optional<PixelBuffer> ImageBufferCGBitmapBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const
+RefPtr<PixelBuffer> ImageBufferCGBitmapBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const
{
return ImageBufferBackend::getPixelBuffer(outputFormat, srcRect, m_data);
}
Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -57,7 +57,7 @@
RefPtr<NativeImage> copyNativeImage(BackingStoreCopy = CopyBackingStore) const final;
- std::optional<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&) const final;
+ RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&) const final;
void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat) final;
void* m_data;
Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -190,7 +190,7 @@
return ImageBufferCGBackend::copyCGImageForEncoding(destinationUTI, preserveResolution);
}
-std::optional<PixelBuffer> ImageBufferIOSurfaceBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const
+RefPtr<PixelBuffer> ImageBufferIOSurfaceBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const
{
IOSurface::Locker lock(*m_surface);
return ImageBufferBackend::getPixelBuffer(outputFormat, srcRect, lock.surfaceBaseAddress());
Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -62,7 +62,7 @@
RefPtr<NativeImage> copyNativeImage(BackingStoreCopy = CopyBackingStore) const override;
RefPtr<NativeImage> sinkIntoNativeImage() override;
- std::optional<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&) const override;
+ RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&) const override;
void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat) override;
bool isInUse() const override;
Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm 2022-06-02 01:07:19 UTC (rev 295113)
@@ -740,13 +740,13 @@
}
#endif
-std::optional<PixelBuffer> GraphicsContextGLANGLE::readCompositedResults()
+RefPtr<PixelBuffer> GraphicsContextGLANGLE::readCompositedResults()
{
auto& displayBuffer = m_swapChain.displayBuffer();
if (!displayBuffer.surface || !displayBuffer.handle)
- return std::nullopt;
+ return nullptr;
if (displayBuffer.surface->size() != getInternalFramebufferSize())
- return std::nullopt;
+ return nullptr;
// Note: We are using GL to read the IOSurface. At the time of writing, there are no convinient
// functions to convert the IOSurface pixel data to ImageData. The image data ends up being
// drawn to a ImageBuffer, but at the time there's no functions to construct a NativeImage
@@ -757,7 +757,7 @@
ScopedRestoreTextureBinding restoreBinding(drawingBufferTextureTargetQueryForDrawingTarget(drawingBufferTextureTarget()), textureTarget, textureTarget != TEXTURE_RECTANGLE_ARB);
GL_BindTexture(textureTarget, texture);
if (!EGL_BindTexImage(m_displayObj, displayBuffer.handle, EGL_BACK_BUFFER))
- return std::nullopt;
+ return nullptr;
GL_TexParameteri(textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
ScopedFramebuffer fbo;
ScopedRestoreReadFramebufferBinding fboBinding(m_isForWebGL2, m_state.boundReadFBO, fbo);
Modified: trunk/Source/WebCore/platform/graphics/cv/VideoFrameCV.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/cv/VideoFrameCV.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/cv/VideoFrameCV.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -41,7 +41,7 @@
public:
WEBCORE_EXPORT static Ref<VideoFrameCV> create(MediaTime presentationTime, bool isMirrored, Rotation, RetainPtr<CVPixelBufferRef>&&);
WEBCORE_EXPORT static Ref<VideoFrameCV> create(CMSampleBufferRef, bool isMirrored, Rotation);
- static RefPtr<VideoFrameCV> createFromPixelBuffer(PixelBuffer&&);
+ static RefPtr<VideoFrameCV> createFromPixelBuffer(Ref<PixelBuffer>&&);
WEBCORE_EXPORT ~VideoFrameCV();
CVPixelBufferRef pixelBuffer() const final { return m_pixelBuffer.get(); }
@@ -75,7 +75,7 @@
auto pixelBuffer = decoder.template decode<RetainPtr<CVPixelBufferRef>>();
if (!decoder.isValid() || !*pixelBuffer)
return std::nullopt;
- return VideoFrameCV::create(*presentationTime, *isMirrored, *rotation, WTFMove(*pixelBuffer));
+ return VideoFrameCV::create(*presentationTime, *isMirrored, *rotation, pixelBuffer.releaseNonNull());
}
}
Modified: trunk/Source/WebCore/platform/graphics/cv/VideoFrameCV.mm (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/cv/VideoFrameCV.mm 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/cv/VideoFrameCV.mm 2022-06-02 01:07:19 UTC (rev 295113)
@@ -50,13 +50,13 @@
return adoptRef(*new VideoFrameCV(presentationTime, isMirrored, rotation, WTFMove(pixelBuffer)));
}
-RefPtr<VideoFrameCV> VideoFrameCV::createFromPixelBuffer(PixelBuffer&& pixelBuffer)
+RefPtr<VideoFrameCV> VideoFrameCV::createFromPixelBuffer(Ref<PixelBuffer>&& pixelBuffer)
{
- auto size = pixelBuffer.size();
+ auto size = pixelBuffer->size();
auto width = size.width();
auto height = size.height();
- auto data = ""
+ auto data = ""
auto dataBaseAddress = data->data();
auto leakedData = &data.leakRef();
Modified: trunk/Source/WebCore/platform/graphics/filters/FilterImage.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/filters/FilterImage.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterImage.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -167,13 +167,13 @@
}
}
-static std::optional<PixelBuffer> getConvertedPixelBuffer(ImageBuffer& imageBuffer, AlphaPremultiplication alphaFormat, const IntRect& sourceRect, DestinationColorSpace colorSpace)
+static RefPtr<PixelBuffer> getConvertedPixelBuffer(ImageBuffer& imageBuffer, AlphaPremultiplication alphaFormat, const IntRect& sourceRect, DestinationColorSpace colorSpace)
{
auto clampedSize = ImageBuffer::clampedSize(sourceRect.size());
auto convertedImageBuffer = ImageBuffer::create(clampedSize, RenderingPurpose::Unspecified, 1, colorSpace, PixelFormat::BGRA8);
if (!convertedImageBuffer)
- return std::nullopt;
+ return nullptr;
// Color space conversion happens internally when drawing from one image buffer to another
convertedImageBuffer->context().drawImageBuffer(imageBuffer, sourceRect);
@@ -181,7 +181,7 @@
return convertedImageBuffer->getPixelBuffer(format, sourceRect);
}
-static std::optional<PixelBuffer> getConvertedPixelBuffer(PixelBuffer& sourcePixelBuffer, AlphaPremultiplication alphaFormat, DestinationColorSpace colorSpace)
+static RefPtr<PixelBuffer> getConvertedPixelBuffer(PixelBuffer& sourcePixelBuffer, AlphaPremultiplication alphaFormat, DestinationColorSpace colorSpace)
{
auto sourceRect = IntRect { { } , sourcePixelBuffer.size() };
auto clampedSize = ImageBuffer::clampedSize(sourceRect.size());
@@ -189,7 +189,7 @@
auto& sourceColorSpace = sourcePixelBuffer.format().colorSpace;
auto imageBuffer = ImageBuffer::create(clampedSize, RenderingPurpose::Unspecified, 1, sourceColorSpace, PixelFormat::BGRA8);
if (!imageBuffer)
- return std::nullopt;
+ return nullptr;
imageBuffer->putPixelBuffer(sourcePixelBuffer, sourceRect);
return getConvertedPixelBuffer(*imageBuffer, alphaFormat, sourceRect, colorSpace);
@@ -209,7 +209,7 @@
#endif
}
-std::optional<PixelBuffer>& FilterImage::pixelBufferSlot(AlphaPremultiplication alphaFormat)
+RefPtr<PixelBuffer>& FilterImage::pixelBufferSlot(AlphaPremultiplication alphaFormat)
{
return alphaFormat == AlphaPremultiplication::Unpremultiplied ? m_unpremultipliedPixelBuffer : m_premultipliedPixelBuffer;
}
@@ -218,7 +218,7 @@
{
auto& pixelBuffer = pixelBufferSlot(alphaFormat);
if (pixelBuffer)
- return &pixelBuffer.value();
+ return pixelBuffer.get();
PixelBufferFormat format { alphaFormat, PixelFormat::RGBA8, m_colorSpace };
@@ -226,7 +226,7 @@
pixelBuffer = m_imageBuffer->getPixelBuffer(format, { { }, m_absoluteImageRect.size() });
if (!pixelBuffer)
return nullptr;
- return &pixelBuffer.value();
+ return pixelBuffer.get();
}
IntSize logicalSize(m_absoluteImageRect.size());
@@ -244,10 +244,10 @@
copyImageBytes(*sourcePixelBuffer, *pixelBuffer);
}
- return &pixelBuffer.value();
+ return pixelBuffer.get();
}
-std::optional<PixelBuffer> FilterImage::getPixelBuffer(AlphaPremultiplication alphaFormat, const IntRect& sourceRect, std::optional<DestinationColorSpace> colorSpace)
+RefPtr<PixelBuffer> FilterImage::getPixelBuffer(AlphaPremultiplication alphaFormat, const IntRect& sourceRect, std::optional<DestinationColorSpace> colorSpace)
{
ASSERT(!ImageBuffer::sizeNeedsClamping(sourceRect.size()));
@@ -255,7 +255,7 @@
auto pixelBuffer = PixelBuffer::tryCreate(format, sourceRect.size());
if (!pixelBuffer)
- return std::nullopt;
+ return nullptr;
copyPixelBuffer(*pixelBuffer, sourceRect);
return pixelBuffer;
@@ -266,7 +266,7 @@
auto alphaFormat = destinationPixelBuffer.format().alphaFormat;
auto& colorSpace = destinationPixelBuffer.format().colorSpace;
- auto* sourcePixelBuffer = pixelBufferSlot(alphaFormat) ? &pixelBufferSlot(alphaFormat).value() : nullptr;
+ auto* sourcePixelBuffer = pixelBufferSlot(alphaFormat) ? pixelBufferSlot(alphaFormat).get() : nullptr;
if (!sourcePixelBuffer) {
if (requiresPixelBufferColorSpaceConversion(colorSpace)) {
@@ -357,8 +357,8 @@
imageBuffer->transformToColorSpace(colorSpace);
m_colorSpace = colorSpace;
- m_unpremultipliedPixelBuffer = std::nullopt;
- m_premultipliedPixelBuffer = std::nullopt;
+ m_unpremultipliedPixelBuffer = nullptr;
+ m_premultipliedPixelBuffer = nullptr;
#endif
}
Modified: trunk/Source/WebCore/platform/graphics/filters/FilterImage.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/filters/FilterImage.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterImage.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -65,7 +65,7 @@
WEBCORE_EXPORT ImageBuffer* imageBuffer();
PixelBuffer* pixelBuffer(AlphaPremultiplication);
- std::optional<PixelBuffer> getPixelBuffer(AlphaPremultiplication, const IntRect& sourceRect, std::optional<DestinationColorSpace> = std::nullopt);
+ RefPtr<PixelBuffer> getPixelBuffer(AlphaPremultiplication, const IntRect& sourceRect, std::optional<DestinationColorSpace> = std::nullopt);
void copyPixelBuffer(PixelBuffer& destinationPixelBuffer, const IntRect& sourceRect);
void correctPremultipliedPixelBuffer();
@@ -80,7 +80,7 @@
FilterImage(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, bool isAlphaImage, bool isValidPremultiplied, RenderingMode, const DestinationColorSpace&);
FilterImage(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, Ref<ImageBuffer>&&);
- std::optional<PixelBuffer>& pixelBufferSlot(AlphaPremultiplication);
+ RefPtr<PixelBuffer>& pixelBufferSlot(AlphaPremultiplication);
ImageBuffer* imageBufferFromPixelBuffer();
@@ -100,8 +100,8 @@
DestinationColorSpace m_colorSpace;
RefPtr<ImageBuffer> m_imageBuffer;
- std::optional<PixelBuffer> m_unpremultipliedPixelBuffer;
- std::optional<PixelBuffer> m_premultipliedPixelBuffer;
+ RefPtr<PixelBuffer> m_unpremultipliedPixelBuffer;
+ RefPtr<PixelBuffer> m_premultipliedPixelBuffer;
#if USE(CORE_IMAGE)
RetainPtr<CIImage> m_ciImage;
Modified: trunk/Source/WebCore/platform/graphics/filters/software/FEGaussianBlurSoftwareApplier.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/filters/software/FEGaussianBlurSoftwareApplier.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/filters/software/FEGaussianBlurSoftwareApplier.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -386,9 +386,8 @@
IntSize blockSize = { paintSize.width(), endY - startY };
if (!job) {
- // FIXME: No need to create a PixelBuffer if it is RefCounted class.
- params.ioBuffer = PixelBuffer(ioBuffer.format(), ioBuffer.size(), { ioBuffer.data() });
- params.tempBuffer = PixelBuffer(tempBuffer.format(), tempBuffer.size(), { tempBuffer.data() });
+ params.ioBuffer = &ioBuffer;
+ params.tempBuffer = &tempBuffer;
} else {
params.ioBuffer = ioBuffer.createScratchPixelBuffer(blockSize);
params.tempBuffer = tempBuffer.createScratchPixelBuffer(blockSize);
Modified: trunk/Source/WebCore/platform/graphics/filters/software/FEGaussianBlurSoftwareApplier.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/filters/software/FEGaussianBlurSoftwareApplier.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/filters/software/FEGaussianBlurSoftwareApplier.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -43,8 +43,8 @@
bool apply(const Filter&, const FilterImageVector& inputs, FilterImage& result) const final;
struct ApplyParameters {
- std::optional<PixelBuffer> ioBuffer;
- std::optional<PixelBuffer> tempBuffer;
+ RefPtr<PixelBuffer> ioBuffer;
+ RefPtr<PixelBuffer> tempBuffer;
int width;
int height;
unsigned kernelSizeX;
Modified: trunk/Source/WebCore/platform/graphics/gbm/GraphicsContextGLGBM.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/gbm/GraphicsContextGLGBM.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/gbm/GraphicsContextGLGBM.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -149,7 +149,7 @@
{
}
-std::optional<PixelBuffer> GraphicsContextGLANGLE::readCompositedResults()
+RefPtr<PixelBuffer> GraphicsContextGLANGLE::readCompositedResults()
{
return readRenderingResults();
}
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/VideoFrameGStreamer.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/gstreamer/VideoFrameGStreamer.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/VideoFrameGStreamer.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -30,13 +30,13 @@
namespace WebCore {
-Ref<VideoFrameGStreamer> VideoFrameGStreamer::createFromPixelBuffer(PixelBuffer&& pixelBuffer, const MediaTime& presentationTime, const IntSize& destinationSize, double frameRate, Rotation videoRotation, bool videoMirrored, std::optional<VideoFrameTimeMetadata>&& metadata)
+Ref<VideoFrameGStreamer> VideoFrameGStreamer::createFromPixelBuffer(Ref<PixelBuffer>&& pixelBuffer, const MediaTime& presentationTime, const IntSize& destinationSize, double frameRate, Rotation videoRotation, bool videoMirrored, std::optional<VideoFrameTimeMetadata>&& metadata)
{
ensureGStreamerInitialized();
- auto size = pixelBuffer.size();
+ auto size = pixelBuffer->size();
- auto data = ""
+ auto data = ""
auto sizeInBytes = data->byteLength();
auto dataBaseAddress = data->data();
auto leakedData = &data.leakRef();
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/VideoFrameGStreamer.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/gstreamer/VideoFrameGStreamer.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/VideoFrameGStreamer.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -43,7 +43,7 @@
return adoptRef(*new VideoFrameGStreamer(sample, presentationTime, videoRotation));
}
- static Ref<VideoFrameGStreamer> createFromPixelBuffer(PixelBuffer&&, const MediaTime& presentationTime = MediaTime::invalidTime(), const IntSize& destinationSize = { }, double frameRate = 1, Rotation videoRotation = Rotation::None, bool videoMirrored = false, std::optional<VideoFrameTimeMetadata>&& metadata = std::nullopt);
+ static Ref<VideoFrameGStreamer> createFromPixelBuffer(Ref<PixelBuffer>&&, const MediaTime& presentationTime = MediaTime::invalidTime(), const IntSize& destinationSize = { }, double frameRate = 1, Rotation videoRotation = Rotation::None, bool videoMirrored = false, std::optional<VideoFrameTimeMetadata>&& metadata = std::nullopt);
GstSample* sample() const { return m_sample.get(); }
RefPtr<JSC::Uint8ClampedArray> computeRGBAImageData() const;
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -347,7 +347,7 @@
{
}
-std::optional<PixelBuffer> GraphicsContextGLOpenGL::readCompositedResults()
+RefPtr<PixelBuffer> GraphicsContextGLOpenGL::readCompositedResults()
{
return readRenderingResults();
}
@@ -416,7 +416,7 @@
::glFlush();
}
-std::optional<PixelBuffer> GraphicsContextGLOpenGL::readRenderingResults()
+RefPtr<PixelBuffer> GraphicsContextGLOpenGL::readRenderingResults()
{
bool mustRestoreFBO = false;
if (contextAttributes().antialias) {
@@ -3114,7 +3114,7 @@
auto pixelBuffer = readRenderingResults();
if (!pixelBuffer)
return;
- paintToCanvas(contextAttributes(), WTFMove(*pixelBuffer), imageBuffer.backendSize(), imageBuffer.context());
+ paintToCanvas(contextAttributes(), pixelBuffer.releaseNonNull(), imageBuffer.backendSize(), imageBuffer.context());
}
void GraphicsContextGLOpenGL::paintCompositedResultsToCanvas(ImageBuffer& imageBuffer)
@@ -3126,14 +3126,14 @@
auto pixelBuffer = readCompositedResults();
if (!pixelBuffer)
return;
- paintToCanvas(contextAttributes(), WTFMove(*pixelBuffer), imageBuffer.backendSize(), imageBuffer.context());
+ paintToCanvas(contextAttributes(), pixelBuffer.releaseNonNull(), imageBuffer.backendSize(), imageBuffer.context());
}
-std::optional<PixelBuffer> GraphicsContextGLOpenGL::paintRenderingResultsToPixelBuffer()
+RefPtr<PixelBuffer> GraphicsContextGLOpenGL::paintRenderingResultsToPixelBuffer()
{
// Reading premultiplied alpha would involve unpremultiplying, which is lossy.
if (contextAttributes().premultipliedAlpha)
- return std::nullopt;
+ return nullptr;
auto results = readRenderingResultsForPainting();
if (results && !results->size().isEmpty()) {
ASSERT(results->format().pixelFormat == PixelFormat::RGBA8 || results->format().pixelFormat == PixelFormat::BGRA8);
@@ -3152,21 +3152,21 @@
return results;
}
-std::optional<PixelBuffer> GraphicsContextGLOpenGL::readRenderingResultsForPainting()
+RefPtr<PixelBuffer> GraphicsContextGLOpenGL::readRenderingResultsForPainting()
{
if (!makeContextCurrent())
- return std::nullopt;
+ return nullptr;
if (getInternalFramebufferSize().isEmpty())
- return std::nullopt;
+ return nullptr;
return readRenderingResults();
}
-std::optional<PixelBuffer> GraphicsContextGLOpenGL::readCompositedResultsForPainting()
+RefPtr<PixelBuffer> GraphicsContextGLOpenGL::readCompositedResultsForPainting()
{
if (!makeContextCurrent())
- return std::nullopt;
+ return nullptr;
if (getInternalFramebufferSize().isEmpty())
- return std::nullopt;
+ return nullptr;
return readCompositedResults();
}
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -377,11 +377,11 @@
// Helper methods.
void paintRenderingResultsToCanvas(ImageBuffer&) final;
- std::optional<PixelBuffer> paintRenderingResultsToPixelBuffer() final;
+ RefPtr<PixelBuffer> paintRenderingResultsToPixelBuffer() final;
void paintCompositedResultsToCanvas(ImageBuffer&) final;
- std::optional<PixelBuffer> readRenderingResultsForPainting();
- std::optional<PixelBuffer> readCompositedResultsForPainting();
+ RefPtr<PixelBuffer> readRenderingResultsForPainting();
+ RefPtr<PixelBuffer> readCompositedResultsForPainting();
void setContextVisibility(bool) final;
@@ -441,9 +441,9 @@
// Did the most recent drawing operation leave the GPU in an acceptable state?
void checkGPUStatus();
- std::optional<PixelBuffer> readRenderingResults();
- std::optional<PixelBuffer> readCompositedResults();
- std::optional<PixelBuffer> readPixelsForPaintResults();
+ RefPtr<PixelBuffer> readRenderingResults();
+ RefPtr<PixelBuffer> readCompositedResults();
+ RefPtr<PixelBuffer> readPixelsForPaintResults();
bool reshapeFBOs(const IntSize&);
void resolveMultisamplingIfNecessary(const IntRect& = IntRect());
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -61,12 +61,12 @@
namespace WebCore {
-std::optional<PixelBuffer> GraphicsContextGLOpenGL::readPixelsForPaintResults()
+RefPtr<PixelBuffer> GraphicsContextGLOpenGL::readPixelsForPaintResults()
{
PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB() };
auto pixelBuffer = PixelBuffer::tryCreate(format, getInternalFramebufferSize());
if (!pixelBuffer)
- return std::nullopt;
+ return nullptr;
GLint packAlignment = 4;
bool mustRestorePackAlignment = false;
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -64,12 +64,12 @@
::glBindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
}
-std::optional<PixelBuffer> GraphicsContextGLOpenGL::readPixelsForPaintResults()
+RefPtr<PixelBuffer> GraphicsContextGLOpenGL::readPixelsForPaintResults()
{
PixelBufferFormat format { AlphaPremultiplication::Unpremultiplied, PixelFormat::RGBA8, DestinationColorSpace::SRGB() };
auto pixelBuffer = PixelBuffer::tryCreate(format, getInternalFramebufferSize());
if (!pixelBuffer)
- return std::nullopt;
+ return nullptr;
GLint packAlignment = 4;
bool mustRestorePackAlignment = false;
Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -121,7 +121,7 @@
{
#if USE(GSTREAMER)
if (auto pixelBuffer = readCompositedResults())
- return VideoFrameGStreamer::createFromPixelBuffer(WTFMove(*pixelBuffer));
+ return VideoFrameGStreamer::createFromPixelBuffer(pixelBuffer.releaseNonNull());
#endif
return nullptr;
}
Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -96,7 +96,7 @@
{
}
-std::optional<PixelBuffer> GraphicsContextGLANGLE::readCompositedResults()
+RefPtr<PixelBuffer> GraphicsContextGLANGLE::readCompositedResults()
{
return readRenderingResults();
}
@@ -150,7 +150,7 @@
{
#if USE(GSTREAMER)
if (auto pixelBuffer = readCompositedResults())
- return VideoFrameGStreamer::createFromPixelBuffer(WTFMove(*pixelBuffer));
+ return VideoFrameGStreamer::createFromPixelBuffer(pixelBuffer.releaseNonNull());
#endif
return nullptr;
}
Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.cpp (295112 => 295113)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -164,7 +164,7 @@
std::optional<VideoFrameTimeMetadata> metadata;
metadata->captureTime = MonotonicTime::now().secondsSinceEpoch();
auto presentationTime = MediaTime::createWithDouble((elapsedTime() + 100_ms).seconds());
- auto videoFrame = VideoFrameGStreamer::createFromPixelBuffer(WTFMove(*pixelBuffer), presentationTime, size(), frameRate(), videoFrameRotation(), false, WTFMove(metadata));
+ auto videoFrame = VideoFrameGStreamer::createFromPixelBuffer(pixelBuffer.releaseNonNull(), presentationTime, size(), frameRate(), videoFrameRotation(), false, WTFMove(metadata));
dispatchVideoFrameToObservers(videoFrame.get(), { });
}
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp (295112 => 295113)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -240,7 +240,7 @@
}
#endif
-void RemoteGraphicsContextGL::paintPixelBufferToImageBuffer(std::optional<WebCore::PixelBuffer>&& pixelBuffer, QualifiedRenderingResourceIdentifier target, CompletionHandler<void()>&& completionHandler)
+void RemoteGraphicsContextGL::paintPixelBufferToImageBuffer(RefPtr<WebCore::PixelBuffer>&& pixelBuffer, QualifiedRenderingResourceIdentifier target, CompletionHandler<void()>&& completionHandler)
{
assertIsCurrent(workQueue());
// FIXME: We do not have functioning read/write fences in RemoteRenderingBackend. Thus this is synchronous,
@@ -258,7 +258,7 @@
// Here we do not try to play back pending commands for imageBuffer. Currently this call is only made for empty
// image buffers and there's no good way to add display lists.
if (pixelBuffer)
- GraphicsContextGL::paintToCanvas(contextAttributes, WTFMove(*pixelBuffer), imageBuffer->backendSize(), imageBuffer->context());
+ GraphicsContextGL::paintToCanvas(contextAttributes, pixelBuffer.releaseNonNull(), imageBuffer->backendSize(), imageBuffer->context());
else
imageBuffer->context().clearRect({ IntPoint(), imageBuffer->backendSize() });
// Unfortunately "flush" implementation in RemoteRenderingBackend overloads ordering and effects.
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h (295112 => 295113)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -142,7 +142,7 @@
private:
void paintRenderingResultsToCanvasWithQualifiedIdentifier(QualifiedRenderingResourceIdentifier, CompletionHandler<void()>&&);
void paintCompositedResultsToCanvasWithQualifiedIdentifier(QualifiedRenderingResourceIdentifier, CompletionHandler<void()>&&);
- void paintPixelBufferToImageBuffer(std::optional<WebCore::PixelBuffer>&&, QualifiedRenderingResourceIdentifier, CompletionHandler<void()>&&);
+ void paintPixelBufferToImageBuffer(RefPtr<WebCore::PixelBuffer>&&, QualifiedRenderingResourceIdentifier, CompletionHandler<void()>&&);
protected:
WeakPtr<GPUConnectionToWebProcess> m_gpuConnectionToWebProcess;
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in (295112 => 295113)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in 2022-06-02 01:07:19 UTC (rev 295113)
@@ -294,7 +294,7 @@
void GetTranslatedShaderSourceANGLE(uint32_t arg0) -> (String returnValue) Synchronous
void DrawBuffersEXT(IPC::ArrayReference<uint32_t> bufs)
void GetInternalformativ(uint32_t target, uint32_t internalformat, uint32_t pname, uint64_t paramsSize) -> (IPC::ArrayReference<int32_t> params) Synchronous
- void PaintRenderingResultsToPixelBuffer() -> (std::optional<WebCore::PixelBuffer> returnValue) Synchronous
+ void PaintRenderingResultsToPixelBuffer() -> (std::optional<IPC::PixelBufferReference> returnValue) Synchronous
}
#endif
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h (295112 => 295113)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -1340,11 +1340,12 @@
m_context->getInternalformativ(target, internalformat, pname, params);
completionHandler(IPC::ArrayReference<int32_t>(reinterpret_cast<int32_t*>(params.data()), params.size()));
}
- void paintRenderingResultsToPixelBuffer(CompletionHandler<void(std::optional<WebCore::PixelBuffer>&&)>&& completionHandler)
+ void paintRenderingResultsToPixelBuffer(CompletionHandler<void(std::optional<IPC::PixelBufferReference>&&)>&& completionHandler)
{
- std::optional<WebCore::PixelBuffer> returnValue = { };
+ std::optional<IPC::PixelBufferReference> returnValue = { };
assertIsCurrent(workQueue());
- returnValue = m_context->paintRenderingResultsToPixelBuffer();
+ if (auto pixelBuffer = m_context->paintRenderingResultsToPixelBuffer())
+ returnValue = pixelBuffer.releaseNonNull();
completionHandler(WTFMove(returnValue));
}
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp (295112 => 295113)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -234,11 +234,13 @@
m_getPixelBufferSharedMemory = nullptr;
}
-void RemoteRenderingBackend::putPixelBufferForImageBuffer(RenderingResourceIdentifier imageBuffer, PixelBuffer&& pixelBuffer, IntRect&& srcRect, IntPoint&& destPoint, AlphaPremultiplication destFormat)
+void RemoteRenderingBackend::putPixelBufferForImageBuffer(RenderingResourceIdentifier imageBuffer, IPC::PixelBufferReference&& pixelBufferReference, IntRect&& srcRect, IntPoint&& destPoint, AlphaPremultiplication destFormat)
{
QualifiedRenderingResourceIdentifier qualifiedImageBuffer { imageBuffer, m_gpuConnectionToWebProcess->webProcessIdentifier() };
- if (auto imageBuffer = m_remoteResourceCache.cachedImageBuffer(qualifiedImageBuffer))
+ if (auto imageBuffer = m_remoteResourceCache.cachedImageBuffer(qualifiedImageBuffer)) {
+ auto pixelBuffer = pixelBufferReference.takePixelBuffer();
imageBuffer->putPixelBuffer(pixelBuffer, srcRect, destPoint, destFormat);
+ }
}
void RemoteRenderingBackend::getDataURLForImageBuffer(const String& mimeType, std::optional<double> quality, PreserveResolution preserveResolution, RenderingResourceIdentifier renderingResourceIdentifier, CompletionHandler<void(String&&)>&& completionHandler)
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h (295112 => 295113)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -32,6 +32,7 @@
#include "MarkSurfacesAsVolatileRequestIdentifier.h"
#include "MessageReceiver.h"
#include "MessageSender.h"
+#include "PixelBufferReference.h"
#include "QualifiedRenderingResourceIdentifier.h"
#include "RemoteResourceCache.h"
#include "RenderingBackendIdentifier.h"
@@ -112,7 +113,7 @@
void getPixelBufferForImageBuffer(WebCore::RenderingResourceIdentifier, WebCore::PixelBufferFormat&&, WebCore::IntRect&& srcRect, CompletionHandler<void()>&&);
void getPixelBufferForImageBufferWithNewMemory(WebCore::RenderingResourceIdentifier, SharedMemory::IPCHandle&&, WebCore::PixelBufferFormat&& destinationFormat, WebCore::IntRect&& srcRect, CompletionHandler<void()>&&);
void destroyGetPixelBufferSharedMemory();
- void putPixelBufferForImageBuffer(WebCore::RenderingResourceIdentifier, WebCore::PixelBuffer&&, WebCore::IntRect&& srcRect, WebCore::IntPoint&& destPoint, WebCore::AlphaPremultiplication destFormat);
+ void putPixelBufferForImageBuffer(WebCore::RenderingResourceIdentifier, IPC::PixelBufferReference&&, WebCore::IntRect&& srcRect, WebCore::IntPoint&& destPoint, WebCore::AlphaPremultiplication destFormat);
void getDataURLForImageBuffer(const String& mimeType, std::optional<double> quality, WebCore::PreserveResolution, WebCore::RenderingResourceIdentifier, CompletionHandler<void(String&&)>&&);
void getDataForImageBuffer(const String& mimeType, std::optional<double> quality, WebCore::RenderingResourceIdentifier, CompletionHandler<void(Vector<uint8_t>&&)>&&);
void getShareableBitmapForImageBuffer(WebCore::RenderingResourceIdentifier, WebCore::PreserveResolution, CompletionHandler<void(ShareableBitmap::Handle&&)>&&);
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in (295112 => 295113)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in 2022-06-02 01:07:19 UTC (rev 295113)
@@ -27,7 +27,7 @@
GetPixelBufferForImageBuffer(WebCore::RenderingResourceIdentifier imageBuffer, struct WebCore::PixelBufferFormat outputFormat, WebCore::IntRect srcRect) -> () Synchronous
GetPixelBufferForImageBufferWithNewMemory(WebCore::RenderingResourceIdentifier imageBuffer, WebKit::SharedMemory::IPCHandle handle, struct WebCore::PixelBufferFormat outputFormat, WebCore::IntRect srcRect) -> () Synchronous NotStreamEncodable
DestroyGetPixelBufferSharedMemory()
- PutPixelBufferForImageBuffer(WebCore::RenderingResourceIdentifier imageBuffer, WebCore::PixelBuffer pixelBuffer, WebCore::IntRect srcRect, WebCore::IntPoint destPoint, enum:uint8_t WebCore::AlphaPremultiplication destFormat)
+ PutPixelBufferForImageBuffer(WebCore::RenderingResourceIdentifier imageBuffer, IPC::PixelBufferReference pixelBuffer, WebCore::IntRect srcRect, WebCore::IntPoint destPoint, enum:uint8_t WebCore::AlphaPremultiplication destFormat)
GetDataURLForImageBuffer(String mimeType, std::optional<double> quality, enum:uint8_t WebCore::PreserveResolution preserveResolution, WebCore::RenderingResourceIdentifier renderingResourceIdentifier) -> (String urlString) Synchronous
GetDataForImageBuffer(String mimeType, std::optional<double> quality, WebCore::RenderingResourceIdentifier renderingResourceIdentifier) -> (Vector<uint8_t> data) Synchronous
GetShareableBitmapForImageBuffer(WebCore::RenderingResourceIdentifier imageBuffer, enum:uint8_t WebCore::PreserveResolution preserveResolution) -> (WebKit::ShareableBitmap::Handle handle) Synchronous NotStreamEncodableReply
Added: trunk/Source/WebKit/Platform/IPC/PixelBufferReference.h (0 => 295113)
--- trunk/Source/WebKit/Platform/IPC/PixelBufferReference.h (rev 0)
+++ trunk/Source/WebKit/Platform/IPC/PixelBufferReference.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2022 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 <WebCore/PixelBuffer.h>
+
+namespace IPC {
+
+class PixelBufferReference {
+public:
+ PixelBufferReference(Ref<WebCore::PixelBuffer>&& pixelBuffer)
+ : m_pixelBuffer(WTFMove(pixelBuffer))
+ {
+ }
+
+ Ref<WebCore::PixelBuffer> takePixelBuffer() { return WTFMove(m_pixelBuffer); }
+
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static std::optional<PixelBufferReference> decode(Decoder&);
+
+private:
+ Ref<WebCore::PixelBuffer> m_pixelBuffer;
+};
+
+template<class Encoder>
+void PixelBufferReference::encode(Encoder& encoder) const
+{
+ m_pixelBuffer->encode(encoder);
+}
+
+template<class Decoder>
+std::optional<PixelBufferReference> PixelBufferReference::decode(Decoder& decoder)
+{
+ return WebCore::PixelBuffer::decode(decoder);
+}
+
+} // namespace IPC
Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (295112 => 295113)
--- trunk/Source/WebKit/Scripts/webkit/messages.py 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py 2022-06-02 01:07:19 UTC (rev 295113)
@@ -255,6 +255,7 @@
'IPC::DataReference',
'IPC::FilterReference',
'IPC::FontReference',
+ 'IPC::PixelBufferReference',
'IPC::Semaphore',
'MachSendRight',
'MediaTime',
Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp (295112 => 295113)
--- trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -131,10 +131,10 @@
return nullptr;
}
-std::optional<WebCore::PixelBuffer> CGDisplayListImageBufferBackend::getPixelBuffer(const WebCore::PixelBufferFormat&, const WebCore::IntRect&) const
+RefPtr<WebCore::PixelBuffer> CGDisplayListImageBufferBackend::getPixelBuffer(const WebCore::PixelBufferFormat&, const WebCore::IntRect&) const
{
ASSERT_NOT_REACHED();
- return { };
+ return nullptr;
}
void CGDisplayListImageBufferBackend::putPixelBuffer(const WebCore::PixelBuffer&, const WebCore::IntRect&, const WebCore::IntPoint&, WebCore::AlphaPremultiplication)
Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h (295112 => 295113)
--- trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -49,7 +49,7 @@
// NOTE: These all ASSERT_NOT_REACHED().
RefPtr<WebCore::NativeImage> copyNativeImage(WebCore::BackingStoreCopy = WebCore::CopyBackingStore) const final;
- std::optional<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& outputFormat, const WebCore::IntRect&) const final;
+ RefPtr<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& outputFormat, const WebCore::IntRect&) const final;
void putPixelBuffer(const WebCore::PixelBuffer&, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, WebCore::AlphaPremultiplication destFormat) final;
protected:
Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h (295112 => 295113)
--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -46,7 +46,6 @@
#include <WebCore/LayoutSize.h>
#include <WebCore/LengthBox.h>
#include <WebCore/MediaSelectionOption.h>
-#include <WebCore/NativeImage.h>
#include <WebCore/NetworkLoadMetrics.h>
#include <WebCore/NotificationDirection.h>
#include <WebCore/RealtimeMediaSource.h>
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (295112 => 295113)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2022-06-02 01:07:19 UTC (rev 295113)
@@ -5372,6 +5372,7 @@
7203449A26A6C44C000A5F54 /* MonotonicObjectIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MonotonicObjectIdentifier.h; sourceTree = "<group>"; };
7203449B26A6C476000A5F54 /* RenderingUpdateID.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderingUpdateID.h; sourceTree = "<group>"; };
7227800B2408BD7D007D376B /* PlatformRemoteImageBufferProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformRemoteImageBufferProxy.h; sourceTree = "<group>"; };
+ 722E1CDB2840B7E7005828BD /* PixelBufferReference.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PixelBufferReference.h; sourceTree = "<group>"; };
7246963A275B7E6700A9156A /* FilterReference.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilterReference.h; sourceTree = "<group>"; };
726D56DD253A64810002EF90 /* RemoteResourceCache.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteResourceCache.cpp; sourceTree = "<group>"; };
726D56DE253A64810002EF90 /* RemoteResourceCache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteResourceCache.h; sourceTree = "<group>"; };
@@ -8280,6 +8281,7 @@
1A3EED0D161A535300AEB4F5 /* MessageReceiverMap.h */,
1AAB0377185A7C6A00EDF501 /* MessageSender.cpp */,
1AAB0378185A7C6A00EDF501 /* MessageSender.h */,
+ 722E1CDB2840B7E7005828BD /* PixelBufferReference.h */,
7BE9326227F5C75A00D5FEFB /* ReceiverMatcher.h */,
7BAB110F25DD02B2008FC479 /* ScopedActiveMessageReceiveQueue.h */,
2DC18001D90DDD15FC6991A9 /* SharedBufferReference.cpp */,
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp (295112 => 295113)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -158,7 +158,7 @@
return m_bitmap->createImage();
}
-std::optional<PixelBuffer> ImageBufferShareableBitmapBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const
+RefPtr<PixelBuffer> ImageBufferShareableBitmapBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const
{
return ImageBufferBackend::getPixelBuffer(outputFormat, srcRect, m_bitmap->data());
}
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h (295112 => 295113)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -65,7 +65,7 @@
RefPtr<WebCore::NativeImage> copyNativeImage(WebCore::BackingStoreCopy = WebCore::CopyBackingStore) const final;
RefPtr<WebCore::Image> copyImage(WebCore::BackingStoreCopy = WebCore::CopyBackingStore, WebCore::PreserveResolution = WebCore::PreserveResolution::No) const final;
- std::optional<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& outputFormat, const WebCore::IntRect&) const final;
+ RefPtr<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& outputFormat, const WebCore::IntRect&) const final;
void putPixelBuffer(const WebCore::PixelBuffer&, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, WebCore::AlphaPremultiplication destFormat) final;
void setOwnershipIdentity(const WebCore::ProcessIdentity&) { }
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h (295112 => 295113)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -321,7 +321,7 @@
String getTranslatedShaderSourceANGLE(PlatformGLObject arg0) final;
void drawBuffersEXT(GCGLSpan<const GCGLenum> bufs) final;
void getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLSpan<GCGLint> params) final;
- std::optional<WebCore::PixelBuffer> paintRenderingResultsToPixelBuffer() final;
+ RefPtr<WebCore::PixelBuffer> paintRenderingResultsToPixelBuffer() final;
// End of list used by generate-gpup-webgl script.
static bool handleMessageToRemovedDestination(IPC::Connection&, IPC::Decoder&);
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp (295112 => 295113)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -2299,15 +2299,17 @@
}
}
-std::optional<WebCore::PixelBuffer> RemoteGraphicsContextGLProxy::paintRenderingResultsToPixelBuffer()
+RefPtr<WebCore::PixelBuffer> RemoteGraphicsContextGLProxy::paintRenderingResultsToPixelBuffer()
{
- std::optional<WebCore::PixelBuffer> returnValue = { };
+ std::optional<IPC::PixelBufferReference> returnValue;
if (!isContextLost()) {
auto sendResult = sendSync(Messages::RemoteGraphicsContextGL::PaintRenderingResultsToPixelBuffer(), Messages::RemoteGraphicsContextGL::PaintRenderingResultsToPixelBuffer::Reply(returnValue));
if (!sendResult)
markContextLost();
}
- return returnValue;
+ if (!returnValue)
+ return nullptr;
+ return returnValue->takePixelBuffer();
}
}
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h (295112 => 295113)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -229,18 +229,18 @@
return m_remoteRenderingBackendProxy->getFilteredImage(m_renderingResourceIdentifier, filter);
}
- std::optional<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& destinationFormat, const WebCore::IntRect& srcRect) const final
+ RefPtr<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& destinationFormat, const WebCore::IntRect& srcRect) const final
{
if (UNLIKELY(!m_remoteRenderingBackendProxy))
- return std::nullopt;
+ return nullptr;
auto& mutableThis = const_cast<RemoteImageBufferProxy&>(*this);
mutableThis.flushDrawingContextAsync();
auto pixelBuffer = WebCore::PixelBuffer::tryCreate(destinationFormat, srcRect.size());
if (!pixelBuffer)
- return std::nullopt;
+ return nullptr;
auto& data = ""
if (!m_remoteRenderingBackendProxy->getPixelBufferForImageBuffer(m_renderingResourceIdentifier, destinationFormat, srcRect, { data.data(), data.byteLength() }))
- return std::nullopt;
+ return nullptr;
return pixelBuffer;
}
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp (295112 => 295113)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -173,7 +173,7 @@
void RemoteRenderingBackendProxy::putPixelBufferForImageBuffer(RenderingResourceIdentifier imageBuffer, const PixelBuffer& pixelBuffer, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat)
{
- sendToStream(Messages::RemoteRenderingBackend::PutPixelBufferForImageBuffer(imageBuffer, pixelBuffer, srcRect, destPoint, destFormat));
+ sendToStream(Messages::RemoteRenderingBackend::PutPixelBufferForImageBuffer(imageBuffer, IPC::PixelBufferReference { Ref { const_cast<PixelBuffer&>(pixelBuffer) } }, srcRect, destPoint, destFormat));
}
std::optional<SharedMemory::Handle> RemoteRenderingBackendProxy::updateSharedMemoryForGetPixelBuffer(size_t dataSize)
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp (295112 => 295113)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp 2022-06-02 01:07:19 UTC (rev 295113)
@@ -130,10 +130,10 @@
return { };
}
-std::optional<PixelBuffer> ImageBufferRemoteIOSurfaceBackend::getPixelBuffer(const PixelBufferFormat&, const IntRect&) const
+RefPtr<PixelBuffer> ImageBufferRemoteIOSurfaceBackend::getPixelBuffer(const PixelBufferFormat&, const IntRect&) const
{
RELEASE_ASSERT_NOT_REACHED();
- return { };
+ return nullptr;
}
void ImageBufferRemoteIOSurfaceBackend::putPixelBuffer(const PixelBuffer&, const IntRect&, const IntPoint&, AlphaPremultiplication)
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h (295112 => 295113)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h 2022-06-02 00:39:13 UTC (rev 295112)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h 2022-06-02 01:07:19 UTC (rev 295113)
@@ -63,7 +63,7 @@
RefPtr<WebCore::Image> copyImage(WebCore::BackingStoreCopy, WebCore::PreserveResolution) const final;
String toDataURL(const String& mimeType, std::optional<double> quality, WebCore::PreserveResolution) const final;
Vector<uint8_t> toData(const String& mimeType, std::optional<double> quality) const final;
- std::optional<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& outputFormat, const WebCore::IntRect&) const final;
+ RefPtr<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& outputFormat, const WebCore::IntRect&) const final;
void putPixelBuffer(const WebCore::PixelBuffer&, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, WebCore::AlphaPremultiplication destFormat) final;
bool originAtBottomLeftCorner() const final { return isOriginAtBottomLeftCorner; }