WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-218843-20201111214650.patch (text/plain), 28.74 KB, created by
Said Abou-Hallawa
on 2020-11-11 21:46:51 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2020-11-11 21:46:51 PST
Size:
28.74 KB
patch
obsolete
>Subversion Revision: 269709 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index dd9e92b9955e49ae300158043ef02f8482d7438d..ec3f5dbc4b03bd044d84d6f060a5b5b40f14b588 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,59 @@ >+2020-11-11 Said Abou-Hallawa <said@apple.com> >+ >+ [GPU Process] Implement DisplayList::ClipToImageBuffer item >+ https://bugs.webkit.org/show_bug.cgi?id=218843 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Record the renderingResourceIdentifier of the ImageBuffer. At replaying >+ time, the renderingResourceIdentifier of the ClipToImageBuffer will be >+ resolved to an ImageBuffer. The actual clipping will be moved to an new >+ function named ImageBuffer::clipToMask(). >+ >+ * platform/graphics/ConcreteImageBuffer.h: >+ * platform/graphics/GraphicsContext.cpp: >+ (WebCore::GraphicsContext::clipToImageBuffer): >+ * platform/graphics/ImageBuffer.h: >+ * platform/graphics/ImageBufferBackend.h: >+ (WebCore::ImageBufferBackend::clipToMask): >+ * platform/graphics/cairo/GraphicsContextCairo.cpp: >+ (WebCore::GraphicsContext::clipToImageBuffer): Deleted. >+ * platform/graphics/cairo/ImageBufferCairoBackend.cpp: >+ (WebCore::ImageBufferCairoBackend::clipToMask): >+ * platform/graphics/cairo/ImageBufferCairoBackend.h: >+ * platform/graphics/cg/GraphicsContextCG.cpp: >+ (WebCore::GraphicsContext::clipToImageBuffer): Deleted. >+ * platform/graphics/cg/ImageBufferCGBackend.cpp: >+ (WebCore::ImageBufferCGBackend::clipToMask): >+ * platform/graphics/cg/ImageBufferCGBackend.h: >+ * platform/graphics/displaylists/DisplayList.cpp: >+ (WebCore::DisplayList::DisplayList::append): >+ * platform/graphics/displaylists/DisplayListItemBuffer.cpp: >+ (WebCore::DisplayList::ItemHandle::apply): >+ (WebCore::DisplayList::ItemHandle::destroy): >+ (WebCore::DisplayList::ItemHandle::copyTo const): >+ * platform/graphics/displaylists/DisplayListItemType.cpp: >+ (WebCore::DisplayList::sizeOfItemInBytes): >+ (WebCore::DisplayList::isDrawingItem): >+ (WebCore::DisplayList::isInlineItem): >+ * platform/graphics/displaylists/DisplayListItemType.h: >+ * platform/graphics/displaylists/DisplayListItems.cpp: >+ (WebCore::DisplayList::ClipToImageBuffer::apply const): >+ (WebCore::DisplayList::operator<<): >+ * platform/graphics/displaylists/DisplayListItems.h: >+ (WebCore::DisplayList::ClipToImageBuffer::ClipToImageBuffer): >+ (WebCore::DisplayList::ClipToImageBuffer::imageBufferIdentifier const): >+ (WebCore::DisplayList::ClipToImageBuffer::destinationRect const): >+ * platform/graphics/displaylists/DisplayListRecorder.cpp: >+ (WebCore::DisplayList::Recorder::clipToImageBuffer): >+ * platform/graphics/displaylists/DisplayListReplayer.cpp: >+ (WebCore::DisplayList::Replayer::applyItem): >+ * platform/graphics/win/GraphicsContextDirect2D.cpp: >+ (WebCore::GraphicsContext::clipToImageBuffer): Deleted. >+ * platform/graphics/win/ImageBufferDirect2DBackend.cpp: >+ (WebCore::ImageBufferDirect2DBackend::clipToMask): >+ * platform/graphics/win/ImageBufferDirect2DBackend.h: >+ > 2020-11-11 Said Abou-Hallawa <said@apple.com> > > [GPU Process] Cache the NativeImage in GPU Process and allow referencing it with its RemoteResourceIdentifier >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 9206d7200c5bda26ffadd72a1bb51a167ba6e623..c3226dc3ba130c7ed0769b69310d60b566e8b072 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,14 @@ >+2020-11-11 Said Abou-Hallawa <said@apple.com> >+ >+ [GPU Process] Implement DisplayList::ClipToImageBuffer item >+ https://bugs.webkit.org/show_bug.cgi?id=218843 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * GPUProcess/graphics/RemoteRenderingBackend.cpp: >+ (WebKit::RemoteRenderingBackend::decodeItem): >+ * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: >+ > 2020-11-11 Wenson Hsieh <wenson_hsieh@apple.com> > > Add system trace points for the GPU process display list processing loop >diff --git a/Source/WebCore/platform/graphics/ConcreteImageBuffer.h b/Source/WebCore/platform/graphics/ConcreteImageBuffer.h >index 8540215f6237cc0a3d625e32fa967df9a62ec2af..20701fa9a67759caf8006891bda1b47be7bcf548 100644 >--- a/Source/WebCore/platform/graphics/ConcreteImageBuffer.h >+++ b/Source/WebCore/platform/graphics/ConcreteImageBuffer.h >@@ -175,6 +175,14 @@ protected: > backend->drawConsuming(destContext, destRect, srcRect, options); > } > } >+ >+ void clipToMask(GraphicsContext& destContext, const FloatRect& destRect) override >+ { >+ if (auto* backend = ensureBackendCreated()) { >+ flushContext(); >+ backend->clipToMask(destContext, destRect); >+ } >+ } > > void convertToLuminanceMask() override > { >diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp >index 3fee859832a7c0141a07901fa95428bde52a1bd3..8cb125979496bd1909ce722ac0c6bd7722049574 100644 >--- a/Source/WebCore/platform/graphics/GraphicsContext.cpp >+++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp >@@ -886,6 +886,19 @@ GraphicsContext::ClipToDrawingCommandsResult GraphicsContext::clipToDrawingComma > return ClipToDrawingCommandsResult::Success; > } > >+void GraphicsContext::clipToImageBuffer(ImageBuffer& imageBuffer, const FloatRect& destinationRect) >+{ >+ if (paintingDisabled()) >+ return; >+ >+ if (m_impl) { >+ m_impl->clipToImageBuffer(imageBuffer, destinationRect); >+ return; >+ } >+ >+ imageBuffer.clipToMask(*this, destinationRect); >+} >+ > #if !USE(CG) && !USE(DIRECT2D) && !USE(CAIRO) > IntRect GraphicsContext::clipBounds() const > { >diff --git a/Source/WebCore/platform/graphics/ImageBuffer.h b/Source/WebCore/platform/graphics/ImageBuffer.h >index 029b753cc0710613adc212be3ad5d1fd20b84bc1..d52a516d62f87c5e571b4da29b959271ad876b1b 100644 >--- a/Source/WebCore/platform/graphics/ImageBuffer.h >+++ b/Source/WebCore/platform/graphics/ImageBuffer.h >@@ -96,6 +96,8 @@ public: > > WEBCORE_EXPORT static RefPtr<Image> sinkIntoImage(RefPtr<ImageBuffer>, PreserveResolution = PreserveResolution::No); > static void drawConsuming(RefPtr<ImageBuffer>, GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), const ImagePaintingOptions& = { }); >+ >+ virtual void clipToMask(GraphicsContext&, const FloatRect& destRect) = 0; > > virtual void convertToLuminanceMask() = 0; > virtual void transformColorSpace(ColorSpace srcColorSpace, ColorSpace dstColorSpace) = 0; >diff --git a/Source/WebCore/platform/graphics/ImageBufferBackend.h b/Source/WebCore/platform/graphics/ImageBufferBackend.h >index aa9b341a0573f2ad4e9ed3057c0421e9591ae5c1..f213d396c702d65ab89c0cd84720b827b49f7342 100644 >--- a/Source/WebCore/platform/graphics/ImageBufferBackend.h >+++ b/Source/WebCore/platform/graphics/ImageBufferBackend.h >@@ -87,6 +87,8 @@ public: > WEBCORE_EXPORT virtual RefPtr<Image> sinkIntoImage(PreserveResolution); > WEBCORE_EXPORT virtual void drawConsuming(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&); > >+ virtual void clipToMask(GraphicsContext&, const FloatRect&) { } >+ > WEBCORE_EXPORT void convertToLuminanceMask(); > virtual void transformColorSpace(ColorSpace, ColorSpace) { } > >diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp >index 68781063b922109d0f0d58864d5c6286e080182d..e7c4a79cc09816ce06d99bd19a81337e9c1d8b14 100644 >--- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp >+++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp >@@ -255,21 +255,6 @@ void GraphicsContext::clipPath(const Path& path, WindRule clipRule) > Cairo::clipPath(*platformContext(), path, clipRule); > } > >-void GraphicsContext::clipToImageBuffer(ImageBuffer& buffer, const FloatRect& destRect) >-{ >- if (paintingDisabled()) >- return; >- >- if (m_impl) { >- m_impl->clipToImageBuffer(buffer, destRect); >- return; >- } >- >- ASSERT(hasPlatformContext()); >- if (auto nativeImage = buffer.copyNativeImage(DontCopyBackingStore)) >- Cairo::clipToImageBuffer(*platformContext(), nativeImage->platformImage().get(), destRect); >-} >- > IntRect GraphicsContext::clipBounds() const > { > if (paintingDisabled()) >diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferCairoBackend.cpp b/Source/WebCore/platform/graphics/cairo/ImageBufferCairoBackend.cpp >index 7da170e5990be18590e91d4d1caa7d0e3103f818..12a5b60a2e9046a195892baf5dd7ed49633b3e74 100644 >--- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairoBackend.cpp >+++ b/Source/WebCore/platform/graphics/cairo/ImageBufferCairoBackend.cpp >@@ -83,6 +83,12 @@ void ImageBufferCairoBackend::drawPattern(GraphicsContext& destContext, const Fl > Cairo::drawPattern(*destContext.platformContext(), image->platformImage().get(), m_logicalSize, destRect, srcRect, patternTransform, phase, options); > } > >+void ImageBufferCairoBackend::clipToMask(GraphicsContext& destContext, const FloatRect& destRect) >+{ >+ if (auto image = copyNativeImage(DontCopyBackingStore)) >+ Cairo::clipToImageBuffer(*destContext.platformContext(), image->platformImage().get(), destRect); >+} >+ > void ImageBufferCairoBackend::transformColorSpace(ColorSpace srcColorSpace, ColorSpace destColorSpace) > { > if (srcColorSpace == destColorSpace) >diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferCairoBackend.h b/Source/WebCore/platform/graphics/cairo/ImageBufferCairoBackend.h >index 23b919ad522ea178b32c009f5d88d5d716def3a1..49debea850283e0b476f7b29d8cf5d3ca0ab3095 100644 >--- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairoBackend.h >+++ b/Source/WebCore/platform/graphics/cairo/ImageBufferCairoBackend.h >@@ -42,6 +42,8 @@ public: > void draw(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) override; > void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions&) override; > >+ void clipToMask(GraphicsContext&, const FloatRect& destRect) override; >+ > void transformColorSpace(ColorSpace srcColorSpace, ColorSpace destColorSpace) override; > > String toDataURL(const String& mimeType, Optional<double> quality, PreserveResolution) const override; >diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp >index fe9ad37673307865840a3fc003d5a016f086fa8a..26e04c098824acaf4fb8c8772327e909f06bff62 100644 >--- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp >+++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp >@@ -498,30 +498,6 @@ void GraphicsContext::drawPattern(Image& image, const FloatRect& destRect, const > } > } > >-void GraphicsContext::clipToImageBuffer(ImageBuffer& buffer, const FloatRect& destinationRect) >-{ >- if (paintingDisabled()) >- return; >- >- if (m_impl) { >- m_impl->clipToImageBuffer(buffer, destinationRect); >- return; >- } >- >- FloatSize bufferDestinationSize = destinationRect.size(); >- auto nativeImage = buffer.copyNativeImage(DontCopyBackingStore); >- auto image = nativeImage ? nativeImage->platformImage() : nullptr; >- >- CGContextRef context = platformContext(); >- // FIXME: This image needs to be grayscale to be used as an alpha mask here. >- CGContextTranslateCTM(context, destinationRect.x(), destinationRect.y() + bufferDestinationSize.height()); >- CGContextScaleCTM(context, 1, -1); >- CGContextClipToRect(context, FloatRect(FloatPoint(0, bufferDestinationSize.height() - destinationRect.height()), destinationRect.size())); >- CGContextClipToMask(context, FloatRect(FloatPoint(), bufferDestinationSize), image.get()); >- CGContextScaleCTM(context, 1, -1); >- CGContextTranslateCTM(context, -destinationRect.x(), -destinationRect.y() - destinationRect.height()); >-} >- > // Draws a filled rectangle with a stroked border. > void GraphicsContext::drawRect(const FloatRect& rect, float borderThickness) > { >diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp >index 8c5abf7c93e79713f713a6dbde9bc017f21f89bc..7dc10ec5b6cfaca7622d6a8708efbd7ed1c9754e 100644 >--- a/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp >+++ b/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp >@@ -126,6 +126,23 @@ void ImageBufferCGBackend::drawPattern(GraphicsContext& destContext, const Float > image->drawPattern(destContext, destRect, adjustedSrcRect, patternTransform, phase, spacing, options); > } > >+void ImageBufferCGBackend::clipToMask(GraphicsContext& destContext, const FloatRect& destRect) >+{ >+ auto nativeImage = copyNativeImage(DontCopyBackingStore); >+ if (!nativeImage) >+ return; >+ >+ CGContextRef cgContext = destContext.platformContext(); >+ >+ // FIXME: This image needs to be grayscale to be used as an alpha mask here. >+ CGContextTranslateCTM(cgContext, destRect.x(), destRect.maxY()); >+ CGContextScaleCTM(cgContext, 1, -1); >+ CGContextClipToRect(cgContext, { { }, destRect.size() }); >+ CGContextClipToMask(cgContext, { { }, destRect.size() }, nativeImage->platformImage().get()); >+ CGContextScaleCTM(cgContext, 1, -1); >+ CGContextTranslateCTM(cgContext, -destRect.x(), -destRect.maxY()); >+} >+ > AffineTransform ImageBufferCGBackend::baseTransform() const > { > return AffineTransform(1, 0, 0, -1, 0, m_logicalSize.height()); >diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.h b/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.h >index c7ca398034f25a3349247d434f5f659f92af3d43..7ef057ad53a25b92e592d05dc635ec76a69b242d 100644 >--- a/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.h >+++ b/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.h >@@ -38,6 +38,8 @@ public: > > void draw(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) override; > void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions&) override; >+ >+ void clipToMask(GraphicsContext&, const FloatRect& destRect) override; > > AffineTransform baseTransform() const override; > >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp >index 468a3d554562a967635dc1b7699fa2566f4ca87c..0f32827c419e7a60e3abab67bed850e0e840b0ec 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp >@@ -222,6 +222,8 @@ void DisplayList::append(ItemHandle item) > return append<Clip>(item.get<Clip>()); > case ItemType::ClipOut: > return append<ClipOut>(item.get<ClipOut>()); >+ case ItemType::ClipToImageBuffer: >+ return append<ClipToImageBuffer>(item.get<ClipToImageBuffer>()); > case ItemType::ClipOutToPath: > return append<ClipOutToPath>(item.get<ClipOutToPath>()); > case ItemType::ClipPath: >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp >index ec2d6ea5508a22085297a55bc5c173800c5a5c4b..55600f3e724d64a0dbe0d5e3741799379805ff24 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp >@@ -120,6 +120,10 @@ void ItemHandle::apply(GraphicsContext& context) > get<ClipOut>().apply(context); > return; > } >+ case ItemType::ClipToImageBuffer: { >+ get<ClipToImageBuffer>().apply(context); >+ return; >+ } > case ItemType::ClipOutToPath: { > get<ClipOutToPath>().apply(context); > return; >@@ -420,6 +424,10 @@ void ItemHandle::destroy() > static_assert(std::is_trivially_destructible<ClipOut>::value); > return; > } >+ case ItemType::ClipToImageBuffer: { >+ static_assert(std::is_trivially_destructible<ClipToImageBuffer>::value); >+ return; >+ } > case ItemType::ConcatenateCTM: { > static_assert(std::is_trivially_destructible<ConcatenateCTM>::value); > return; >@@ -687,6 +695,10 @@ void ItemHandle::copyTo(ItemHandle destination) const > new (itemOffset) ClipOut(get<ClipOut>()); > return; > } >+ case ItemType::ClipToImageBuffer: { >+ new (itemOffset) ClipToImageBuffer(get<ClipToImageBuffer>()); >+ return; >+ } > case ItemType::ConcatenateCTM: { > new (itemOffset) ConcatenateCTM(get<ConcatenateCTM>()); > return; >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp >index a1ad4601a6d922dc9780084c83410fd5c5eeaab8..852f1a1a6a20157a36bc6e70d77a335ef413d5df 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp >@@ -72,6 +72,8 @@ static size_t sizeOfItemInBytes(ItemType type) > return sizeof(Clip); > case ItemType::ClipOut: > return sizeof(ClipOut); >+ case ItemType::ClipToImageBuffer: >+ return sizeof(ClipToImageBuffer); > case ItemType::ClipOutToPath: > return sizeof(ClipOutToPath); > case ItemType::ClipPath: >@@ -178,6 +180,7 @@ bool isDrawingItem(ItemType type) > case ItemType::ClearShadow: > case ItemType::Clip: > case ItemType::ClipOut: >+ case ItemType::ClipToImageBuffer: > case ItemType::ClipOutToPath: > case ItemType::ClipPath: > case ItemType::ClipToDrawingCommands: >@@ -285,6 +288,7 @@ bool isInlineItem(ItemType type) > case ItemType::ClearShadow: > case ItemType::Clip: > case ItemType::ClipOut: >+ case ItemType::ClipToImageBuffer: > case ItemType::ConcatenateCTM: > case ItemType::DrawDotsForDocumentMarker: > case ItemType::DrawEllipse: >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h b/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h >index 78c817d0ea1444b869ca278a322ba78ec34853c5..f1dc8526a6d85b7c67c03220b20e8eb6c7f6fc98 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h >@@ -48,6 +48,7 @@ enum class ItemType : uint8_t { > ClearShadow, > Clip, > ClipOut, >+ ClipToImageBuffer, > ClipOutToPath, > ClipPath, > ClipToDrawingCommands, >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp >index b5f454315b89f131781c45be0ba5da586323b4ea..472ac1b7da9d3fade717b4584f0d6c1e1e22c815 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp >@@ -302,6 +302,23 @@ static TextStream& operator<<(TextStream& ts, const ClipOut& item) > return ts; > } > >+NO_RETURN_DUE_TO_ASSERT void ClipToImageBuffer::apply(GraphicsContext&) const >+{ >+ ASSERT_NOT_REACHED(); >+} >+ >+void ClipToImageBuffer::apply(GraphicsContext& context, WebCore::ImageBuffer& imageBuffer) const >+{ >+ context.clipToImageBuffer(imageBuffer, m_destinationRect); >+} >+ >+static TextStream& operator<<(TextStream& ts, const ClipToImageBuffer& item) >+{ >+ ts.dumpProperty("image-buffer-identifier", item.imageBufferIdentifier()); >+ ts.dumpProperty("dest-rect", item.destinationRect()); >+ return ts; >+} >+ > void ClipOutToPath::apply(GraphicsContext& context) const > { > context.clipOut(m_path); >@@ -1047,6 +1064,7 @@ static TextStream& operator<<(TextStream& ts, ItemType type) > case ItemType::SetMiterLimit: ts << "set-miter-limit"; break; > case ItemType::Clip: ts << "clip"; break; > case ItemType::ClipOut: ts << "clip-out"; break; >+ case ItemType::ClipToImageBuffer: ts << "clip-to-image-buffer"; break; > case ItemType::ClipOutToPath: ts << "clip-out-to-path"; break; > case ItemType::ClipPath: ts << "clip-path"; break; > case ItemType::ClipToDrawingCommands: ts << "clip-to-image-buffer"; break; >@@ -1153,6 +1171,9 @@ TextStream& operator<<(TextStream& ts, ItemHandle item) > case ItemType::ClipOut: > ts << item.get<ClipOut>(); > break; >+ case ItemType::ClipToImageBuffer: >+ ts << item.get<ClipToImageBuffer>(); >+ break; > case ItemType::ClipOutToPath: > ts << item.get<ClipOutToPath>(); > break; >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h >index d69b6e800af05d0fdae6f8eb36d450478e5c321c..32e492dbe67a8d5671d14a518dff762a3793634c 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h >@@ -740,6 +740,30 @@ private: > FloatRect m_rect; > }; > >+class ClipToImageBuffer { >+public: >+ static constexpr ItemType itemType = ItemType::ClipToImageBuffer; >+ static constexpr bool isInlineItem = true; >+ static constexpr bool isDrawingItem = false; >+ >+ ClipToImageBuffer(RenderingResourceIdentifier imageBufferIdentifier, const FloatRect& destinationRect) >+ : m_imageBufferIdentifier(imageBufferIdentifier) >+ , m_destinationRect(destinationRect) >+ { >+ } >+ >+ RenderingResourceIdentifier imageBufferIdentifier() const { return m_imageBufferIdentifier; } >+ FloatRect destinationRect() const { return m_destinationRect; } >+ >+ void apply(GraphicsContext&, WebCore::ImageBuffer&) const; >+ >+ NO_RETURN_DUE_TO_ASSERT void apply(GraphicsContext&) const; >+ >+private: >+ RenderingResourceIdentifier m_imageBufferIdentifier; >+ FloatRect m_destinationRect; >+}; >+ > class ClipOutToPath { > public: > static constexpr ItemType itemType = ItemType::ClipOutToPath; >@@ -2562,6 +2586,7 @@ template<> struct EnumTraits<WebCore::DisplayList::ItemType> { > WebCore::DisplayList::ItemType::ClearShadow, > WebCore::DisplayList::ItemType::Clip, > WebCore::DisplayList::ItemType::ClipOut, >+ WebCore::DisplayList::ItemType::ClipToImageBuffer, > WebCore::DisplayList::ItemType::ClipOutToPath, > WebCore::DisplayList::ItemType::ClipPath, > WebCore::DisplayList::ItemType::ClipToDrawingCommands, >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >index ca73b7ab9ec0f50ddca771028acbc376db928663..a9c731b7aa7c6677c56657ed967e7fff204e741d 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >@@ -432,9 +432,10 @@ IntRect Recorder::clipBounds() > return IntRect(-2048, -2048, 4096, 4096); > } > >-void Recorder::clipToImageBuffer(ImageBuffer&, const FloatRect&) >+void Recorder::clipToImageBuffer(ImageBuffer& imageBuffer, const FloatRect& destRect) > { >- WTFLogAlways("GraphicsContext::clipToImageBuffer is not compatible with DisplayList::Recorder."); >+ m_displayList.cacheImageBuffer(imageBuffer); >+ append<ClipToImageBuffer>(imageBuffer.renderingResourceIdentifier(), destRect); > } > > void Recorder::clipToDrawingCommands(const FloatRect& destination, ColorSpace colorSpace, Function<void(GraphicsContext&)>&& drawingFunction) >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp >index ab163de0cc63c59b23fce62fc5d3a3dd654547e1..64e66ebd1733478f804aa41c0e24abdf607c90b6 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp >@@ -50,6 +50,13 @@ void Replayer::applyItem(ItemHandle item) > if (m_delegate && m_delegate->apply(item, m_context)) > return; > >+ if (item.is<ClipToImageBuffer>()) { >+ auto& clipItem = item.get<ClipToImageBuffer>(); >+ if (auto* imageBuffer = m_imageBuffers.get(clipItem.imageBufferIdentifier())) >+ clipItem.apply(m_context, *imageBuffer); >+ return; >+ } >+ > if (item.is<DrawImageBuffer>()) { > auto& drawItem = item.get<DrawImageBuffer>(); > if (auto* imageBuffer = m_imageBuffers.get(drawItem.imageBufferIdentifier())) >diff --git a/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp b/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp >index 3a68dc3aa0155368464f517235ec0a319f7d57e3..8c0da27e86bd1174c84d83c2e770f2622ae9ef7e 100644 >--- a/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp >+++ b/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp >@@ -431,15 +431,6 @@ void GraphicsContext::drawPattern(Image& image, const FloatRect& destRect, const > Direct2D::drawPattern(*platformContext(), WTFMove(tileImage), IntSize(image.size()), destRect, tileRect, patternTransform, phase, options.compositeOperator(), options.blendMode()); > } > >-void GraphicsContext::clipToImageBuffer(ImageBuffer& buffer, const FloatRect& destRect) >-{ >- if (paintingDisabled()) >- return; >- >- FloatSize bufferDestinationSize = buffer.sizeForDestinationSize(destRect.size()); >- notImplemented(); >-} >- > // Draws a filled rectangle with a stroked border. > void GraphicsContext::drawRect(const FloatRect& rect, float borderThickness) > { >diff --git a/Source/WebCore/platform/graphics/win/ImageBufferDirect2DBackend.cpp b/Source/WebCore/platform/graphics/win/ImageBufferDirect2DBackend.cpp >index 656cb14e7288f23a8917f22889da73e9bc94a3b8..378aaf4c40c4e122acbe069432c7ad7ec209ed73 100644 >--- a/Source/WebCore/platform/graphics/win/ImageBufferDirect2DBackend.cpp >+++ b/Source/WebCore/platform/graphics/win/ImageBufferDirect2DBackend.cpp >@@ -289,6 +289,11 @@ void ImageBufferDirect2DBackend::drawPattern(GraphicsContext& destContext, const > image->drawPattern(destContext, destRect, adjustedSrcRect, patternTransform, phase, spacing, options); > } > >+void ImageBufferDirect2DBackend::clipToMask(GraphicsContext&, const FloatRect&) >+{ >+ notImplemented(); >+} >+ > String ImageBufferDirect2DBackend::toDataURL(const String&, Optional<double>, PreserveResolution) const > { > notImplemented(); >diff --git a/Source/WebCore/platform/graphics/win/ImageBufferDirect2DBackend.h b/Source/WebCore/platform/graphics/win/ImageBufferDirect2DBackend.h >index 1d574aeecdb9d2280214f1c0caf5fc5600911446..895aefab34c5a8864cb92288c887ee4765b05112 100644 >--- a/Source/WebCore/platform/graphics/win/ImageBufferDirect2DBackend.h >+++ b/Source/WebCore/platform/graphics/win/ImageBufferDirect2DBackend.h >@@ -47,6 +47,8 @@ public: > > RefPtr<Image> sinkIntoImage(PreserveResolution) override; > >+ void clipToMask(GraphicsContext&, const FloatRect& destRect) override; >+ > String toDataURL(const String& mimeType, Optional<double> quality, PreserveResolution) const override; > Vector<uint8_t> toData(const String& mimeType, Optional<double> quality) const override; > Vector<uint8_t> toBGRAData() const override; >diff --git a/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp b/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp >index afd4e9a1a23f127c2b38315004c22054ea0690e7..cf3849c3f6e82a1c74a5b25ef834816c899eab12 100644 >--- a/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp >+++ b/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp >@@ -302,6 +302,7 @@ Optional<DisplayList::ItemHandle> WARN_UNUSED_RETURN RemoteRenderingBackend::dec > case DisplayList::ItemType::ClearShadow: > case DisplayList::ItemType::Clip: > case DisplayList::ItemType::ClipOut: >+ case DisplayList::ItemType::ClipToImageBuffer: > case DisplayList::ItemType::ConcatenateCTM: > case DisplayList::ItemType::DrawDotsForDocumentMarker: > case DisplayList::ItemType::DrawEllipse: >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h >index 427cc45163b350669a83e3d78a2f26e2aedab35e..d8a7d664041d40ff7ad0f2c314dd8f757207573e 100644 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h >@@ -256,6 +256,7 @@ protected: > case WebCore::DisplayList::ItemType::ClearShadow: > case WebCore::DisplayList::ItemType::Clip: > case WebCore::DisplayList::ItemType::ClipOut: >+ case WebCore::DisplayList::ItemType::ClipToImageBuffer: > case WebCore::DisplayList::ItemType::ConcatenateCTM: > case WebCore::DisplayList::ItemType::DrawDotsForDocumentMarker: > case WebCore::DisplayList::ItemType::DrawEllipse:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 218843
:
413908
|
413909
|
413910
|
413915