Title: [269753] trunk/Source
Revision
269753
Author
[email protected]
Date
2020-11-12 14:31:04 -0800 (Thu, 12 Nov 2020)

Log Message

[GPU Process] GraphicsContext::drawPattern() should take a NativeImage argument
https://bugs.webkit.org/show_bug.cgi?id=218865

Reviewed by Simon Fraser.

Source/WebCore:

When recording the DisplayList item DrawPattern, the renderingResourceIdentifier
of the NativeImage will be recorded. When replaying it back, the
renderingResourceIdentifier will be resolved to a NativeImage and the
item will be applied the same way we for DrawNativeImage.

DrawPattern will be inline DisplayList item and should not need encoding
or decoding when sending it to the GPU.

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawPattern):
* platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::drawPattern):
(WebCore::GraphicsContext::drawPlatformImage): Deleted.
* platform/graphics/GraphicsContextImpl.h:
* platform/graphics/Image.cpp:
(WebCore::Image::drawPattern):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawPlatformPattern):
(WebCore::GraphicsContext::drawPattern): Deleted.
* platform/graphics/cairo/GraphicsContextImplCairo.cpp:
(WebCore::GraphicsContextImplCairo::drawPattern):
* platform/graphics/cairo/GraphicsContextImplCairo.h:
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawPlatformPattern):
(WebCore::GraphicsContext::drawPattern): Deleted.
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::destroy):
(WebCore::DisplayList::ItemHandle::copyTo const):
* platform/graphics/displaylists/DisplayListItemType.cpp:
(WebCore::DisplayList::isDrawingItem):
(WebCore::DisplayList::isInlineItem):
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::DrawPattern::DrawPattern):
(WebCore::DisplayList::DrawPattern::apply const):
(WebCore::DisplayList::operator<<):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::DrawPattern::DrawPattern):
(WebCore::DisplayList::DrawPattern::imageIdentifier const):
(WebCore::DisplayList::DrawPattern::imageSize const):
(WebCore::DisplayList::DrawPattern::tileRect const):
(WebCore::DisplayList::DrawPattern::patternTransform const):
(WebCore::DisplayList::DrawPattern::image const): Deleted.
(WebCore::DisplayList::DrawPattern::encode const): Deleted.
(WebCore::DisplayList::DrawPattern::decode): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::drawPattern):
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::applyImageBufferItem):
(WebCore::DisplayList::applyNativeImageItem):
(WebCore::DisplayList::Replayer::applyItem):
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
(Nicosia::CairoOperationRecorder::drawPattern):
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContext::drawPlatformPattern):
(WebCore::GraphicsContext::drawPattern): Deleted.
* platform/graphics/win/GraphicsContextImplDirect2D.cpp:
(WebCore::GraphicsContextImplDirect2D::drawPattern):
* platform/graphics/win/GraphicsContextImplDirect2D.h:

Source/WebKit:

* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::decodeItem):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (269752 => 269753)


--- trunk/Source/WebCore/ChangeLog	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/ChangeLog	2020-11-12 22:31:04 UTC (rev 269753)
@@ -1,3 +1,71 @@
+2020-11-12  Said Abou-Hallawa  <[email protected]>
+
+        [GPU Process] GraphicsContext::drawPattern() should take a NativeImage argument
+        https://bugs.webkit.org/show_bug.cgi?id=218865
+
+        Reviewed by Simon Fraser.
+
+        When recording the DisplayList item DrawPattern, the renderingResourceIdentifier
+        of the NativeImage will be recorded. When replaying it back, the
+        renderingResourceIdentifier will be resolved to a NativeImage and the
+        item will be applied the same way we for DrawNativeImage.
+
+        DrawPattern will be inline DisplayList item and should not need encoding
+        or decoding when sending it to the GPU.
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::drawPattern):
+        * platform/graphics/GraphicsContext.h:
+        (WebCore::GraphicsContext::drawPattern):
+        (WebCore::GraphicsContext::drawPlatformImage): Deleted.
+        * platform/graphics/GraphicsContextImpl.h:
+        * platform/graphics/Image.cpp:
+        (WebCore::Image::drawPattern):
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::drawPlatformPattern):
+        (WebCore::GraphicsContext::drawPattern): Deleted.
+        * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
+        (WebCore::GraphicsContextImplCairo::drawPattern):
+        * platform/graphics/cairo/GraphicsContextImplCairo.h:
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::drawPlatformPattern):
+        (WebCore::GraphicsContext::drawPattern): Deleted.
+        * platform/graphics/displaylists/DisplayListItemBuffer.cpp:
+        (WebCore::DisplayList::ItemHandle::destroy):
+        (WebCore::DisplayList::ItemHandle::copyTo const):
+        * platform/graphics/displaylists/DisplayListItemType.cpp:
+        (WebCore::DisplayList::isDrawingItem):
+        (WebCore::DisplayList::isInlineItem):
+        * platform/graphics/displaylists/DisplayListItems.cpp:
+        (WebCore::DisplayList::DrawPattern::DrawPattern):
+        (WebCore::DisplayList::DrawPattern::apply const):
+        (WebCore::DisplayList::operator<<):
+        * platform/graphics/displaylists/DisplayListItems.h:
+        (WebCore::DisplayList::DrawPattern::DrawPattern):
+        (WebCore::DisplayList::DrawPattern::imageIdentifier const):
+        (WebCore::DisplayList::DrawPattern::imageSize const):
+        (WebCore::DisplayList::DrawPattern::tileRect const):
+        (WebCore::DisplayList::DrawPattern::patternTransform const):
+        (WebCore::DisplayList::DrawPattern::image const): Deleted.
+        (WebCore::DisplayList::DrawPattern::encode const): Deleted.
+        (WebCore::DisplayList::DrawPattern::decode): Deleted.
+        * platform/graphics/displaylists/DisplayListRecorder.cpp:
+        (WebCore::DisplayList::Recorder::drawPattern):
+        * platform/graphics/displaylists/DisplayListRecorder.h:
+        * platform/graphics/displaylists/DisplayListReplayer.cpp:
+        (WebCore::DisplayList::applyImageBufferItem):
+        (WebCore::DisplayList::applyNativeImageItem):
+        (WebCore::DisplayList::Replayer::applyItem):
+        * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
+        (Nicosia::CairoOperationRecorder::drawPattern):
+        * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
+        * platform/graphics/win/GraphicsContextDirect2D.cpp:
+        (WebCore::GraphicsContext::drawPlatformPattern):
+        (WebCore::GraphicsContext::drawPattern): Deleted.
+        * platform/graphics/win/GraphicsContextImplDirect2D.cpp:
+        (WebCore::GraphicsContextImplDirect2D::drawPattern):
+        * platform/graphics/win/GraphicsContextImplDirect2D.h:
+
 2020-11-12  Chris Dumez  <[email protected]>
 
         [GPUProcess] Add basic GPUProcess crash handling for media playback

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -842,6 +842,19 @@
     ImageBuffer::drawConsuming(WTFMove(image), *this, destination, source, options);
 }
 
+void GraphicsContext::drawPattern(NativeImage& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
+{
+    if (paintingDisabled() || !patternTransform.isInvertible())
+        return;
+
+    if (m_impl) {
+        m_impl->drawPattern(image, imageSize, destRect, tileRect, patternTransform, phase, spacing, options);
+        return;
+    }
+
+    drawPlatformPattern(image.platformImage(), imageSize, destRect, tileRect, patternTransform, phase, spacing, options);
+}
+
 void GraphicsContext::clipRoundedRect(const FloatRoundedRect& rect)
 {
     if (paintingDisabled())

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2020-11-12 22:31:04 UTC (rev 269753)
@@ -392,12 +392,12 @@
     void drawImageBuffer(ImageBuffer&, const FloatRect& destination, const ImagePaintingOptions& = { });
     void drawImageBuffer(ImageBuffer&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = { });
 
-    void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { });
-
     WEBCORE_EXPORT void drawConsumingImageBuffer(RefPtr<ImageBuffer>, const FloatPoint& destination, const ImagePaintingOptions& = { });
     void drawConsumingImageBuffer(RefPtr<ImageBuffer>, const FloatRect& destination, const ImagePaintingOptions& = { });
     void drawConsumingImageBuffer(RefPtr<ImageBuffer>, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = { });
 
+    void drawPattern(NativeImage&, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { });
+
     WEBCORE_EXPORT void setImageInterpolationQuality(InterpolationQuality);
     InterpolationQuality imageInterpolationQuality() const { return m_state.imageInterpolationQuality; }
 
@@ -650,7 +650,8 @@
 
     void platformFillRoundedRect(const FloatRoundedRect&, const Color&);
 
-    void drawPlatformImage(const PlatformImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& = { });
+    void drawPlatformImage(const PlatformImagePtr&, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&);
+    void drawPlatformPattern(const PlatformImagePtr&, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions&);
 
     FloatRect computeLineBoundsAndAntialiasingModeForText(const FloatRect&, bool printing, Color&);
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextImpl.h (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/GraphicsContextImpl.h	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextImpl.h	2020-11-12 22:31:04 UTC (rev 269753)
@@ -70,8 +70,8 @@
     virtual void drawGlyphs(const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint& anchorPoint, FontSmoothingMode) = 0;
 
     virtual void drawImageBuffer(ImageBuffer&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&) = 0;
-    virtual void drawNativeImage(NativeImage&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) = 0;
-    virtual void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions&) = 0;
+    virtual void drawNativeImage(NativeImage&, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) = 0;
+    virtual void drawPattern(NativeImage&, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions&) = 0;
 
     virtual void drawRect(const FloatRect&, float borderThickness) = 0;
     virtual void drawLine(const FloatPoint&, const FloatPoint&) = 0;

Modified: trunk/Source/WebCore/platform/graphics/Image.cpp (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/Image.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/Image.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -139,10 +139,11 @@
 
 void Image::drawPattern(GraphicsContext& ctxt, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform,  const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
 {
-    if (!nativeImageForCurrentFrame(&ctxt))
+    auto tileImage = preTransformedNativeImageForCurrentFrame(options.orientation() == ImageOrientation::FromImage);
+    if (!tileImage)
         return;
 
-    ctxt.drawPattern(*this, destRect, tileRect, patternTransform, phase, spacing, options);
+    ctxt.drawPattern(*tileImage, size(), destRect, tileRect, patternTransform, phase, spacing, options);
 
     if (imageObserver())
         imageObserver()->didDraw(*this);

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -655,19 +655,13 @@
     Cairo::fillRectWithRoundedHole(*platformContext(), rect, roundedHoleRect, Cairo::FillSource(state), Cairo::ShadowState(state));
 }
 
-void GraphicsContext::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
+void GraphicsContext::drawPlatformPattern(const PlatformImagePtr& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
 {
-    if (paintingDisabled())
+    if (paintingDisabled() || !patternTransform.isInvertible())
         return;
 
-    if (m_impl) {
-        m_impl->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, options);
-        return;
-    }
-
     ASSERT(hasPlatformContext());
-    if (auto nativeImage = image.nativeImageForCurrentFrame())
-        Cairo::drawPattern(*platformContext(), nativeImage->platformImage().get(), IntSize(image.size()), destRect, tileRect, patternTransform, phase, options);
+    Cairo::drawPattern(*platformContext(), image.get(), IntSize(imageSize), destRect, tileRect, patternTransform, phase, options);
 }
 
 void GraphicsContext::setPlatformShouldAntialias(bool enable)

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -276,10 +276,10 @@
     Cairo::drawPlatformImage(m_platformContext, image.platformImage().get(), destRect, srcRect, { options, state.imageInterpolationQuality }, state.alpha, Cairo::ShadowState(state));
 }
 
-void GraphicsContextImplCairo::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize&, const ImagePaintingOptions& options)
+void GraphicsContextImplCairo::drawPattern(NativeImage& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
 {
-    if (auto nativeImage = image.nativeImageForCurrentFrame())
-        Cairo::drawPattern(m_platformContext, nativeImage->platformImage().get(), IntSize(image.size()), destRect, tileRect, patternTransform, phase, options);
+    UNUSED_PARAM(spacing);
+    Cairo::drawPattern(m_platformContext, image.platformImage().get(), IntSize(imageSize), destRect, tileRect, patternTransform, phase, options);
 }
 
 void GraphicsContextImplCairo::drawRect(const FloatRect& rect, float borderThickness)

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h	2020-11-12 22:31:04 UTC (rev 269753)
@@ -73,7 +73,7 @@
 
     void drawImageBuffer(ImageBuffer&, const FloatRect&, const FloatRect&, const ImagePaintingOptions&) override;
     void drawNativeImage(NativeImage&, const FloatSize&, const FloatRect&, const FloatRect&, const ImagePaintingOptions&) override;
-    void drawPattern(Image&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, const ImagePaintingOptions&) override;
+    void drawPattern(NativeImage&, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions&) override;
 
     void drawRect(const FloatRect&, float) override;
     void drawLine(const FloatPoint&, const FloatPoint&) override;

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -415,16 +415,11 @@
     });
 }
 
-void GraphicsContext::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
+void GraphicsContext::drawPlatformPattern(const PlatformImagePtr& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
 {
     if (paintingDisabled() || !patternTransform.isInvertible())
         return;
 
-    if (m_impl) {
-        m_impl->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, options);
-        return;
-    }
-
     CGContextRef context = platformContext();
     CGContextStateSaver stateSaver(context);
     CGContextClipToRect(context, destRect);
@@ -442,26 +437,23 @@
     float adjustedX = phase.x() - destRect.x() + tileRect.x() * narrowPrecisionToFloat(patternTransform.a()); // We translated the context so that destRect.x() is the origin, so subtract it out.
     float adjustedY = destRect.height() - (phase.y() - destRect.y() + tileRect.y() * narrowPrecisionToFloat(patternTransform.d()) + scaledTileHeight);
 
-    auto tileImage = image.preTransformedNativeImageForCurrentFrame(options.orientation() == ImageOrientation::FromImage);
+    float h = CGImageGetHeight(image.get());
 
-    float h = CGImageGetHeight(tileImage->platformImage().get());
-
     RetainPtr<CGImageRef> subImage;
-    FloatSize imageSize = image.size();
     if (tileRect.size() == imageSize)
-        subImage = tileImage->platformImage();
+        subImage = image;
     else {
         // Copying a sub-image out of a partially-decoded image stops the decoding of the original image. It should never happen
         // because sub-images are only used for border-image, which only renders when the image is fully decoded.
-        ASSERT(h == image.height());
-        subImage = adoptCF(CGImageCreateWithImageInRect(tileImage->platformImage().get(), tileRect));
+        ASSERT(h == imageSize.height());
+        subImage = adoptCF(CGImageCreateWithImageInRect(image.get(), tileRect));
     }
 
     // If we need to paint gaps between tiles because we have a partially loaded image or non-zero spacing,
     // fall back to the less efficient CGPattern-based mechanism.
     float scaledTileWidth = tileRect.width() * narrowPrecisionToFloat(patternTransform.a());
-    float w = CGImageGetWidth(tileImage->platformImage().get());
-    if (w == image.size().width() && h == image.size().height() && !spacing.width() && !spacing.height()) {
+    float w = CGImageGetWidth(image.get());
+    if (w == imageSize.width() && h == imageSize.height() && !spacing.width() && !spacing.height()) {
         // FIXME: CG seems to snap the images to integral sizes. When we care (e.g. with border-image-repeat: round),
         // we should tile all but the last, and stetch the last image to fit.
         CGContextDrawTiledImage(context, FloatRect(adjustedX, adjustedY, scaledTileWidth, scaledTileHeight), subImage.get());
@@ -470,7 +462,7 @@
         CGAffineTransform matrix = CGAffineTransformMake(narrowPrecisionToCGFloat(patternTransform.a()), 0, 0, narrowPrecisionToCGFloat(patternTransform.d()), adjustedX, adjustedY);
         matrix = CGAffineTransformConcat(matrix, CGContextGetCTM(context));
         // The top of a partially-decoded image is drawn at the bottom of the tile. Map it to the top.
-        matrix = CGAffineTransformTranslate(matrix, 0, image.size().height() - h);
+        matrix = CGAffineTransformTranslate(matrix, 0, imageSize.height() - h);
 #if PLATFORM(IOS_FAMILY)
         matrix = CGAffineTransformScale(matrix, 1, -1);
         matrix = CGAffineTransformTranslate(matrix, 0, -h);

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -322,10 +322,6 @@
         get<DrawPath>().~DrawPath();
         return;
     }
-    case ItemType::DrawPattern: {
-        get<DrawPattern>().~DrawPattern();
-        return;
-    }
     case ItemType::FillCompositedRect: {
         get<FillCompositedRect>().~FillCompositedRect();
         return;
@@ -424,6 +420,10 @@
         static_assert(std::is_trivially_destructible<DrawNativeImage>::value);
         return;
     }
+    case ItemType::DrawPattern: {
+        static_assert(std::is_trivially_destructible<DrawPattern>::value);
+        return;
+    }
     case ItemType::DrawLine: {
         static_assert(std::is_trivially_destructible<DrawLine>::value);
         return;
@@ -577,14 +577,14 @@
         new (itemOffset) DrawNativeImage(get<DrawNativeImage>());
         return;
     }
+    case ItemType::DrawPattern: {
+        new (itemOffset) DrawPattern(get<DrawPattern>());
+        return;
+    }
     case ItemType::DrawPath: {
         new (itemOffset) DrawPath(get<DrawPath>());
         return;
     }
-    case ItemType::DrawPattern: {
-        new (itemOffset) DrawPattern(get<DrawPattern>());
-        return;
-    }
     case ItemType::FillCompositedRect: {
         new (itemOffset) FillCompositedRect(get<FillCompositedRect>());
         return;

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -208,8 +208,8 @@
     case ItemType::DrawLine:
     case ItemType::DrawLinesForText:
     case ItemType::DrawNativeImage:
+    case ItemType::DrawPattern:
     case ItemType::DrawPath:
-    case ItemType::DrawPattern:
     case ItemType::DrawRect:
     case ItemType::EndTransparencyLayer:
     case ItemType::FillCompositedRect:
@@ -254,7 +254,6 @@
     case ItemType::DrawGlyphs:
     case ItemType::DrawLinesForText:
     case ItemType::DrawPath:
-    case ItemType::DrawPattern:
     case ItemType::FillCompositedRect:
     case ItemType::FillPath:
     case ItemType::FillRectWithColor:
@@ -282,6 +281,7 @@
     case ItemType::DrawEllipse:
     case ItemType::DrawImageBuffer:
     case ItemType::DrawNativeImage:
+    case ItemType::DrawPattern:
     case ItemType::DrawLine:
     case ItemType::DrawRect:
     case ItemType::EndTransparencyLayer:

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -458,11 +458,12 @@
     return ts;
 }
 
-DrawPattern::DrawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
-    : m_image(image)
+DrawPattern::DrawPattern(RenderingResourceIdentifier imageIdentifier, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
+    : m_imageIdentifier(imageIdentifier)
+    , m_imageSize(imageSize)
+    , m_destination(destRect)
+    , m_tileRect(tileRect)
     , m_patternTransform(patternTransform)
-    , m_tileRect(tileRect)
-    , m_destination(destRect)
     , m_phase(phase)
     , m_spacing(spacing)
     , m_options(options)
@@ -469,14 +470,19 @@
 {
 }
 
-void DrawPattern::apply(GraphicsContext& context) const
+NO_RETURN_DUE_TO_ASSERT void DrawPattern::apply(GraphicsContext&) const
 {
-    context.drawPattern(m_image.get(), m_destination, m_tileRect, m_patternTransform, m_phase, m_spacing, m_options);
+    ASSERT_NOT_REACHED();
 }
 
+void DrawPattern::apply(GraphicsContext& context, NativeImage& image) const
+{
+    context.drawPattern(image, m_imageSize, m_destination, m_tileRect, m_patternTransform, m_phase, m_spacing, m_options);
+}
+
 static TextStream& operator<<(TextStream& ts, const DrawPattern& item)
 {
-    ts.dumpProperty("image", item.image());
+    ts.dumpProperty("image-identifier", item.imageIdentifier());
     ts.dumpProperty("pattern-transform", item.patternTransform());
     ts.dumpProperty("tile-rect", item.tileRect());
     ts.dumpProperty("dest-rect", item.destRect());

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2020-11-12 22:31:04 UTC (rev 269753)
@@ -1079,91 +1079,36 @@
 class DrawPattern {
 public:
     static constexpr ItemType itemType = ItemType::DrawPattern;
-    static constexpr bool isInlineItem = false;
+    static constexpr bool isInlineItem = true;
     static constexpr bool isDrawingItem = true;
 
-    WEBCORE_EXPORT DrawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { });
+    WEBCORE_EXPORT DrawPattern(RenderingResourceIdentifier, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { });
 
-    const Image& image() const { return m_image.get(); }
+    RenderingResourceIdentifier imageIdentifier() const { return m_imageIdentifier; }
+    FloatSize imageSize() const { return m_imageSize; }
+    FloatRect destRect() const { return m_destination; }
+    FloatRect tileRect() const { return m_tileRect; }
     const AffineTransform& patternTransform() const { return m_patternTransform; }
-    FloatRect tileRect() const { return m_tileRect; }
-    FloatRect destRect() const { return m_destination; }
     FloatPoint phase() const { return m_phase; }
     FloatSize spacing() const { return m_spacing; }
 
-    void apply(GraphicsContext&) const;
+    NO_RETURN_DUE_TO_ASSERT void apply(GraphicsContext&) const;
+    void apply(GraphicsContext&, NativeImage&) const;
 
     Optional<FloatRect> globalBounds() const { return WTF::nullopt; }
     Optional<FloatRect> localBounds(const GraphicsContext&) const { return m_destination; }
 
-    template<class Encoder> void encode(Encoder&) const;
-    template<class Decoder> static Optional<DrawPattern> decode(Decoder&);
-
 private:
-    mutable Ref<Image> m_image; // FIXME: Drawing images can cause their animations to progress. This shouldn't have to be mutable.
+    RenderingResourceIdentifier m_imageIdentifier;
+    FloatSize m_imageSize;
+    FloatRect m_destination;
+    FloatRect m_tileRect;
     AffineTransform m_patternTransform;
-    FloatRect m_tileRect;
-    FloatRect m_destination;
     FloatPoint m_phase;
     FloatSize m_spacing;
     ImagePaintingOptions m_options;
 };
 
-template<class Encoder>
-void DrawPattern::encode(Encoder& encoder) const
-{
-    ImageHandle imageHandle;
-    imageHandle.image = m_image.ptr();
-    encoder << imageHandle;
-    encoder << m_patternTransform;
-    encoder << m_tileRect;
-    encoder << m_destination;
-    encoder << m_phase;
-    encoder << m_spacing;
-    encoder << m_options;
-}
-
-template<class Decoder>
-Optional<DrawPattern> DrawPattern::decode(Decoder& decoder)
-{
-    Optional<ImageHandle> imageHandle;
-    decoder >> imageHandle;
-    if (!imageHandle)
-        return WTF::nullopt;
-
-    Optional<AffineTransform> patternTransform;
-    decoder >> patternTransform;
-    if (!patternTransform)
-        return WTF::nullopt;
-
-    Optional<FloatRect> tileRect;
-    decoder >> tileRect;
-    if (!tileRect)
-        return WTF::nullopt;
-
-    Optional<FloatRect> destination;
-    decoder >> destination;
-    if (!destination)
-        return WTF::nullopt;
-
-    Optional<FloatPoint> phase;
-    decoder >> phase;
-    if (!phase)
-        return WTF::nullopt;
-
-    Optional<FloatSize> spacing;
-    decoder >> spacing;
-    if (!spacing)
-        return WTF::nullopt;
-
-    Optional<ImagePaintingOptions> options;
-    decoder >> options;
-    if (!options)
-        return WTF::nullopt;
-
-    return {{ *imageHandle->image, *destination, *tileRect, *patternTransform, *phase, *spacing, *options }};
-}
-
 class BeginTransparencyLayer {
 public:
     static constexpr ItemType itemType = ItemType::BeginTransparencyLayer;

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -182,9 +182,12 @@
     append<DrawNativeImage>(image.renderingResourceIdentifier(), imageSize, destRect, srcRect, options);
 }
 
-void Recorder::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
+void Recorder::drawPattern(NativeImage& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
 {
-    append<DrawPattern>(image, destRect, tileRect, patternTransform, phase, spacing, options);
+    if (m_delegate)
+        m_delegate->cacheNativeImage(image);
+    m_displayList.cacheNativeImage(image);
+    append<DrawPattern>(image.renderingResourceIdentifier(), imageSize, destRect, tileRect, patternTransform, phase, spacing, options);
 }
 
 void Recorder::save()

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2020-11-12 22:31:04 UTC (rev 269753)
@@ -103,8 +103,8 @@
     void drawGlyphs(const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint& anchorPoint, FontSmoothingMode) override;
 
     void drawImageBuffer(WebCore::ImageBuffer&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&) override;
-    void drawNativeImage(NativeImage&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) override;
-    void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions&) override;
+    void drawNativeImage(NativeImage&, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) override;
+    void drawPattern(NativeImage&, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions&) override;
 
     void drawRect(const FloatRect&, float borderThickness) override;
     void drawLine(const FloatPoint&, const FloatPoint&) override;

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -45,31 +45,42 @@
 
 Replayer::~Replayer() = default;
 
+template<class T>
+inline static bool applyImageBufferItem(GraphicsContext& context, const ImageBufferHashMap& imageBuffers, ItemHandle item)
+{
+    if (!item.is<T>())
+        return false;
+    auto& imageBufferItem = item.get<T>();
+    if (auto* imageBuffer = imageBuffers.get(imageBufferItem.imageBufferIdentifier()))
+        imageBufferItem.apply(context, *imageBuffer);
+    return true;
+}
+
+template<class T>
+inline static bool applyNativeImageItem(GraphicsContext& context, const NativeImageHashMap& nativeImages, ItemHandle item)
+{
+    if (!item.is<T>())
+        return false;
+    auto& nativeImageItem = item.get<T>();
+    if (auto* image = nativeImages.get(nativeImageItem.imageIdentifier()))
+        nativeImageItem.apply(context, *image);
+    return true;
+}
+
 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);
+    if (applyImageBufferItem<DrawImageBuffer>(m_context, m_imageBuffers, item))
         return;
-    }
+    if (applyImageBufferItem<ClipToImageBuffer>(m_context, m_imageBuffers, item))
+        return;
 
-    if (item.is<DrawImageBuffer>()) {
-        auto& drawItem = item.get<DrawImageBuffer>();
-        if (auto* imageBuffer = m_imageBuffers.get(drawItem.imageBufferIdentifier()))
-            drawItem.apply(m_context, *imageBuffer);
+    if (applyNativeImageItem<DrawNativeImage>(m_context, m_nativeImages, item))
         return;
-    }
-    
-    if (item.is<DrawNativeImage>()) {
-        auto& drawItem = item.get<DrawNativeImage>();
-        if (auto* image = m_nativeImages.get(drawItem.imageIdentifier()))
-            drawItem.apply(m_context, *image);
+    if (applyNativeImageItem<DrawPattern>(m_context, m_nativeImages, item))
         return;
-    }
 
     item.apply(m_context);
 }

Modified: trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -560,7 +560,7 @@
     append(createCommand<DrawNativeImage>(nativeImage.platformImage(), destRect, srcRect, ImagePaintingOptions(options, state.imageInterpolationQuality), state.alpha, Cairo::ShadowState(state)));
 }
 
-void CairoOperationRecorder::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
+void CairoOperationRecorder::drawPattern(NativeImage& nativeImage, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
 {
     struct DrawPattern final : PaintingOperation, OperationData<RefPtr<cairo_surface_t>, IntSize, FloatRect, FloatRect, AffineTransform, FloatPoint, ImagePaintingOptions> {
         virtual ~DrawPattern() = default;
@@ -577,8 +577,7 @@
     };
 
     UNUSED_PARAM(spacing);
-    if (auto nativeImage = image.nativeImageForCurrentFrame())
-        append(createCommand<DrawPattern>(nativeImage->platformImage(), IntSize(image.size()), destRect, tileRect, patternTransform, phase, options));
+    append(createCommand<DrawPattern>(nativeImage.platformImage(), IntSize(imageSize), destRect, tileRect, patternTransform, phase, options));
 }
 
 void CairoOperationRecorder::drawRect(const FloatRect& rect, float borderThickness)

Modified: trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h	2020-11-12 22:31:04 UTC (rev 269753)
@@ -66,7 +66,7 @@
 
     void drawImageBuffer(WebCore::ImageBuffer&, const WebCore::FloatRect& destination, const WebCore::FloatRect& source, const WebCore::ImagePaintingOptions&) override;
     void drawNativeImage(WebCore::NativeImage&, const WebCore::FloatSize&, const WebCore::FloatRect&, const WebCore::FloatRect&, const WebCore::ImagePaintingOptions&) override;
-    void drawPattern(WebCore::Image&, const WebCore::FloatRect&, const WebCore::FloatRect&, const WebCore::AffineTransform&, const WebCore::FloatPoint&, const WebCore::FloatSize&, const WebCore::ImagePaintingOptions&) override;
+    void drawPattern(WebCore::NativeImage&, const WebCore::FloatSize&, const WebCore::FloatRect&, const WebCore::FloatRect&, const WebCore::AffineTransform&, const WebCore::FloatPoint&, const WebCore::FloatSize&, const WebCore::ImagePaintingOptions&) override;
 
     void drawRect(const WebCore::FloatRect&, float) override;
     void drawLine(const WebCore::FloatPoint&, const WebCore::FloatPoint&) override;

Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -416,19 +416,14 @@
     Direct2D::flush(*platformContext());
 }
 
-void GraphicsContext::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
+void GraphicsContext::drawPlatformPattern(const PlatformImagePtr& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
 {
     if (paintingDisabled() || !patternTransform.isInvertible())
         return;
 
-    if (m_impl) {
-        m_impl->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, options);
-        return;
-    }
-
     ASSERT(hasPlatformContext());
-    if (auto tileImage = image.nativeImageForCurrentFrame(this))
-        Direct2D::drawPattern(*platformContext(), WTFMove(tileImage), IntSize(image.size()), destRect, tileRect, patternTransform, phase, options.compositeOperator(), options.blendMode());
+    auto tileImage = image;
+    Direct2D::drawPattern(*platformContext(), WTFMove(tileImage), IntSize(image.size()), destRect, tileRect, patternTransform, phase, options.compositeOperator(), options.blendMode());
 }
 
 // Draws a filled rectangle with a stroked border.

Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextImplDirect2D.cpp (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextImplDirect2D.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextImplDirect2D.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -274,11 +274,10 @@
     Direct2D::drawNativeImage(m_platformContext, image.platformImage().get(), imageSize, destRect, srcRect, options, state.alpha, Direct2D::ShadowState(state));
 }
 
-void GraphicsContextImplDirect2D::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize&, const ImagePaintingOptions& options)
+void GraphicsContextImplDirect2D::drawPattern((NativeImage& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize&, const ImagePaintingOptions& options)
 {
-    auto* context = &graphicsContext();
-    if (auto surface = image.nativeImageForCurrentFrame(context))
-        Direct2D::drawPattern(m_platformContext, WTFMove(surface), IntSize(image.size()), destRect, tileRect, patternTransform, phase, options.compositeOperator(), options.blendMode());
+    if (auto surface = image.platformImage())
+        Direct2D::drawPattern(m_platformContext, WTFMove(surface), IntSize(imageSize), destRect, tileRect, patternTransform, phase, options.compositeOperator(), options.blendMode());
 }
 
 void GraphicsContextImplDirect2D::drawRect(const FloatRect& rect, float borderThickness)

Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextImplDirect2D.h (269752 => 269753)


--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextImplDirect2D.h	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextImplDirect2D.h	2020-11-12 22:31:04 UTC (rev 269753)
@@ -69,8 +69,8 @@
     void drawGlyphs(const Font&, const GlyphBuffer&, unsigned, unsigned, const FloatPoint&, FontSmoothingMode) override;
 
     bool drawImageBuffer(ImageBuffer&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&) override;
-    bool drawNativeImage(NativeImage&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) override;
-    void drawPattern(Image&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, const ImagePaintingOptions&) override;
+    bool drawNativeImage(NativeImage&, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) override;
+    void drawPattern((NativeImage&, const FloatSize& imageSize, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, const ImagePaintingOptions&) override;
 
     void drawRect(const FloatRect&, float) override;
     void drawLine(const FloatPoint&, const FloatPoint&) override;

Modified: trunk/Source/WebKit/ChangeLog (269752 => 269753)


--- trunk/Source/WebKit/ChangeLog	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebKit/ChangeLog	2020-11-12 22:31:04 UTC (rev 269753)
@@ -1,3 +1,14 @@
+2020-11-12  Said Abou-Hallawa  <[email protected]>
+
+        [GPU Process] GraphicsContext::drawPattern() should take a NativeImage argument
+        https://bugs.webkit.org/show_bug.cgi?id=218865
+
+        Reviewed by Simon Fraser.
+
+        * GPUProcess/graphics/RemoteRenderingBackend.cpp:
+        (WebKit::RemoteRenderingBackend::decodeItem):
+        * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
+
 2020-11-12  Per Arne Vollan  <[email protected]>
 
         [iOS] IOKit sandbox violation when enabling all GPU runtime flags

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp (269752 => 269753)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp	2020-11-12 22:31:04 UTC (rev 269753)
@@ -264,8 +264,6 @@
         return decodeAndCreate<DisplayList::DrawLinesForText>(data, length, handleLocation);
     case DisplayList::ItemType::DrawPath:
         return decodeAndCreate<DisplayList::DrawPath>(data, length, handleLocation);
-    case DisplayList::ItemType::DrawPattern:
-        return decodeAndCreate<DisplayList::DrawPattern>(data, length, handleLocation);
     case DisplayList::ItemType::FillCompositedRect:
         return decodeAndCreate<DisplayList::FillCompositedRect>(data, length, handleLocation);
     case DisplayList::ItemType::FillPath:
@@ -302,6 +300,7 @@
     case DisplayList::ItemType::DrawEllipse:
     case DisplayList::ItemType::DrawImageBuffer:
     case DisplayList::ItemType::DrawNativeImage:
+    case DisplayList::ItemType::DrawPattern:
     case DisplayList::ItemType::DrawLine:
     case DisplayList::ItemType::DrawRect:
     case DisplayList::ItemType::EndTransparencyLayer:

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h (269752 => 269753)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2020-11-12 22:18:46 UTC (rev 269752)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2020-11-12 22:31:04 UTC (rev 269753)
@@ -218,8 +218,6 @@
             return IPC::Encoder::encodeSingleObject<WebCore::DisplayList::DrawLinesForText>(item.get<WebCore::DisplayList::DrawLinesForText>());
         case WebCore::DisplayList::ItemType::DrawPath:
             return IPC::Encoder::encodeSingleObject<WebCore::DisplayList::DrawPath>(item.get<WebCore::DisplayList::DrawPath>());
-        case WebCore::DisplayList::ItemType::DrawPattern:
-            return IPC::Encoder::encodeSingleObject<WebCore::DisplayList::DrawPattern>(item.get<WebCore::DisplayList::DrawPattern>());
         case WebCore::DisplayList::ItemType::FillCompositedRect:
             return IPC::Encoder::encodeSingleObject<WebCore::DisplayList::FillCompositedRect>(item.get<WebCore::DisplayList::FillCompositedRect>());
         case WebCore::DisplayList::ItemType::FillPath:
@@ -256,6 +254,7 @@
         case WebCore::DisplayList::ItemType::DrawEllipse:
         case WebCore::DisplayList::ItemType::DrawImageBuffer:
         case WebCore::DisplayList::ItemType::DrawNativeImage:
+        case WebCore::DisplayList::ItemType::DrawPattern:
         case WebCore::DisplayList::ItemType::DrawLine:
         case WebCore::DisplayList::ItemType::DrawRect:
         case WebCore::DisplayList::ItemType::EndTransparencyLayer:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to