Title: [279460] trunk/Source
Revision
279460
Author
carlo...@webkit.org
Date
2021-07-01 03:35:07 -0700 (Thu, 01 Jul 2021)

Log Message

[Cairo] Simplify GraphicsContextCairo creation
https://bugs.webkit.org/show_bug.cgi?id=227575

Reviewed by Žan Doberšek.

Source/WebCore:

Remove the constructors taking a PlatformContextCairo and add two that receive a RefPtr<cairo_t>&& and
cairo_surface_t*. In both cases the PlatformContextCairo is created, so it's now always owned and callers don't
need to create it.

No change in behavior, covered by existing tests.

* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContextCairo::GraphicsContextCairo):
(WebCore::GraphicsContextCairo::drawLine):
* platform/graphics/cairo/GraphicsContextCairo.h:
* platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp:
(WebCore::ImageBufferCairoSurfaceBackend::ImageBufferCairoSurfaceBackend):
(WebCore::ImageBufferCairoSurfaceBackend::context const):
* platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h:
* platform/graphics/cairo/NativeImageCairo.cpp:
* platform/graphics/cairo/PlatformContextCairo.cpp:
(WebCore::PlatformContextCairo::PlatformContextCairo):
* platform/graphics/cairo/PlatformContextCairo.h:
(WebCore::PlatformContextCairo::cr const):
(WebCore::PlatformContextCairo::cr): Deleted.
(WebCore::PlatformContextCairo::setCr): Deleted.
* platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp:
(Nicosia::PaintingContextCairo::ForPainting::ForPainting):
(Nicosia::PaintingContextCairo::ForPainting::~ForPainting):
(Nicosia::PaintingContextCairo::ForPainting::replay):
* platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.h:
* platform/graphics/win/GraphicsContextCairoWin.cpp:
(WebCore::GraphicsContextCairo::GraphicsContextCairo):
* platform/graphics/win/ImageCairoWin.cpp:
(WebCore::BitmapImage::getHBITMAPOfSize):

Source/WebKit:

Use the new GraphicsContextCairo constructors.

* Shared/cairo/ShareableBitmapCairo.cpp:
(WebKit::ShareableBitmap::createGraphicsContext):
* UIProcess/cairo/BackingStoreCairo.cpp:
(WebKit::BackingStore::incorporateUpdate):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (279459 => 279460)


--- trunk/Source/WebCore/ChangeLog	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebCore/ChangeLog	2021-07-01 10:35:07 UTC (rev 279460)
@@ -1,3 +1,41 @@
+2021-07-01  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [Cairo] Simplify GraphicsContextCairo creation
+        https://bugs.webkit.org/show_bug.cgi?id=227575
+
+        Reviewed by Žan Doberšek.
+
+        Remove the constructors taking a PlatformContextCairo and add two that receive a RefPtr<cairo_t>&& and
+        cairo_surface_t*. In both cases the PlatformContextCairo is created, so it's now always owned and callers don't
+        need to create it.
+
+        No change in behavior, covered by existing tests.
+
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContextCairo::GraphicsContextCairo):
+        (WebCore::GraphicsContextCairo::drawLine):
+        * platform/graphics/cairo/GraphicsContextCairo.h:
+        * platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp:
+        (WebCore::ImageBufferCairoSurfaceBackend::ImageBufferCairoSurfaceBackend):
+        (WebCore::ImageBufferCairoSurfaceBackend::context const):
+        * platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h:
+        * platform/graphics/cairo/NativeImageCairo.cpp:
+        * platform/graphics/cairo/PlatformContextCairo.cpp:
+        (WebCore::PlatformContextCairo::PlatformContextCairo):
+        * platform/graphics/cairo/PlatformContextCairo.h:
+        (WebCore::PlatformContextCairo::cr const):
+        (WebCore::PlatformContextCairo::cr): Deleted.
+        (WebCore::PlatformContextCairo::setCr): Deleted.
+        * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp:
+        (Nicosia::PaintingContextCairo::ForPainting::ForPainting):
+        (Nicosia::PaintingContextCairo::ForPainting::~ForPainting):
+        (Nicosia::PaintingContextCairo::ForPainting::replay):
+        * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.h:
+        * platform/graphics/win/GraphicsContextCairoWin.cpp:
+        (WebCore::GraphicsContextCairo::GraphicsContextCairo):
+        * platform/graphics/win/ImageCairoWin.cpp:
+        (WebCore::BitmapImage::getHBITMAPOfSize):
+
 2021-07-01  Youenn Fablet  <you...@apple.com>
 
         RealtimeIncomingAudioSourceCocoa should support other sample rate than 48000

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


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2021-07-01 10:35:07 UTC (rev 279460)
@@ -57,26 +57,18 @@
 
 namespace WebCore {
 
-GraphicsContextCairo::GraphicsContextCairo(PlatformContextCairo& platformContext)
-    : m_platformContext(platformContext)
+GraphicsContextCairo::GraphicsContextCairo(RefPtr<cairo_t>&& cr)
+    : m_platformContext(WTFMove(cr))
     , m_private(makeUnique<GraphicsContextPlatformPrivate>(m_platformContext.cr()))
 {
     m_platformContext.setGraphicsContextPrivate(m_private.get());
 }
 
-GraphicsContextCairo::GraphicsContextCairo(cairo_t* cairoContext)
-    : m_ownedPlatformContext(makeUnique<PlatformContextCairo>(cairoContext))
-    , m_platformContext(*m_ownedPlatformContext)
-    , m_private(makeUnique<GraphicsContextPlatformPrivate>(m_platformContext.cr()))
+GraphicsContextCairo::GraphicsContextCairo(cairo_surface_t* surface)
+    : GraphicsContextCairo(adoptRef(cairo_create(surface)))
 {
-    m_platformContext.setGraphicsContextPrivate(m_private.get());
 }
 
-GraphicsContextCairo::GraphicsContextCairo(PlatformContextCairo* platformContext)
-    : GraphicsContextCairo(*platformContext)
-{
-}
-
 GraphicsContextCairo::~GraphicsContextCairo()
 {
     m_platformContext.setGraphicsContextPrivate(nullptr);
@@ -133,7 +125,6 @@
     if (strokeStyle() == NoStroke)
         return;
 
-    ASSERT(hasPlatformContext());
     auto& state = this->state();
     Cairo::drawLine(*platformContext(), point1, point2, state.strokeStyle, state.strokeColor, state.strokeThickness, state.shouldAntialias);
 }

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.h (279459 => 279460)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.h	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.h	2021-07-01 10:35:07 UTC (rev 279460)
@@ -29,21 +29,21 @@
 #if USE(CAIRO)
 
 #include "GraphicsContext.h"
+#include "PlatformContextCairo.h"
 
 typedef struct _cairo cairo_t;
+typedef struct _cairo_surface cairo_surface_t;
 
 namespace WebCore {
 
-class PlatformContextCairo;
-
 class WEBCORE_EXPORT GraphicsContextCairo final : public GraphicsContext {
 public:
-    GraphicsContextCairo(PlatformContextCairo&);
-    GraphicsContextCairo(PlatformContextCairo*);
-    GraphicsContextCairo(cairo_t*);
+    explicit GraphicsContextCairo(RefPtr<cairo_t>&&);
+    explicit GraphicsContextCairo(cairo_surface_t*);
 
 #if PLATFORM(WIN)
     GraphicsContextCairo(HDC, bool hasAlpha = false); // FIXME: To be removed.
+    explicit GraphicsContextCairo(PlatformContextCairo*);
 #endif
 
     virtual ~GraphicsContextCairo();
@@ -114,8 +114,7 @@
 #endif
 
 private:
-    std::unique_ptr<PlatformContextCairo> m_ownedPlatformContext;
-    PlatformContextCairo& m_platformContext;
+    mutable PlatformContextCairo m_platformContext;
 
     std::unique_ptr<GraphicsContextPlatformPrivate> m_private;
 };

Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp (279459 => 279460)


--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp	2021-07-01 10:35:07 UTC (rev 279460)
@@ -34,7 +34,6 @@
 #include "CairoOperations.h"
 #include "Color.h"
 #include "GraphicsContext.h"
-#include "GraphicsContextCairo.h"
 #include "ImageBufferUtilitiesCairo.h"
 #include "PixelBuffer.h"
 #include <cairo.h>
@@ -46,17 +45,14 @@
 ImageBufferCairoSurfaceBackend::ImageBufferCairoSurfaceBackend(const Parameters& parameters, RefPtr<cairo_surface_t>&& surface)
     : ImageBufferCairoBackend(parameters)
     , m_surface(WTFMove(surface))
+    , m_context(m_surface.get())
 {
     ASSERT(cairo_surface_status(m_surface.get()) == CAIRO_STATUS_SUCCESS);
-
-    RefPtr<cairo_t> cr = adoptRef(cairo_create(m_surface.get()));
-    m_platformContext.setCr(cr.get());
-    m_context = makeUnique<GraphicsContextCairo>(m_platformContext);
 }
 
 GraphicsContext& ImageBufferCairoSurfaceBackend::context() const
 {
-    return *m_context;
+    return m_context;
 }
 
 IntSize ImageBufferCairoSurfaceBackend::backendSize() const

Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h (279459 => 279460)


--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h	2021-07-01 10:35:07 UTC (rev 279460)
@@ -31,8 +31,8 @@
 
 #if USE(CAIRO)
 
+#include "GraphicsContextCairo.h"
 #include "ImageBufferCairoBackend.h"
-#include "PlatformContextCairo.h"
 
 namespace WebCore {
 
@@ -53,9 +53,8 @@
     RefPtr<NativeImage> cairoSurfaceCoerceToImage() const;
     unsigned bytesPerRow() const override;
 
-    mutable RefPtr<cairo_surface_t> m_surface;
-    PlatformContextCairo m_platformContext { nullptr };
-    std::unique_ptr<GraphicsContext> m_context;
+    RefPtr<cairo_surface_t> m_surface;
+    mutable GraphicsContextCairo m_context;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp (279459 => 279460)


--- trunk/Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp	2021-07-01 10:35:07 UTC (rev 279460)
@@ -30,7 +30,6 @@
 
 #include "CairoOperations.h"
 #include "CairoUtilities.h"
-#include "PlatformContextCairo.h"
 #include <cairo.h>
 
 namespace WebCore {

Modified: trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp (279459 => 279460)


--- trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp	2021-07-01 10:35:07 UTC (rev 279460)
@@ -46,8 +46,8 @@
     } m_mask;
 };
 
-PlatformContextCairo::PlatformContextCairo(cairo_t* cr)
-    : m_cr(cr)
+PlatformContextCairo::PlatformContextCairo(RefPtr<cairo_t>&& cr)
+    : m_cr(WTFMove(cr))
 {
     m_stateStack.append(State());
     m_state = &m_stateStack.last();

Modified: trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h (279459 => 279460)


--- trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h	2021-07-01 10:35:07 UTC (rev 279460)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef PlatformContextCairo_h
-#define PlatformContextCairo_h
+#pragma once
 
 #if USE(CAIRO)
 
@@ -42,8 +41,7 @@
 struct ShadowState;
 }
 
-// Much like PlatformContextSkia in the Skia port, this class holds information that
-// would normally be private to GraphicsContext, except that we want to allow access
+// This class holds information that would normally be private to GraphicsContext, except that we want to allow access
 // to it in Font and Image code. This allows us to separate the concerns of Cairo-specific
 // code from the platform-independent GraphicsContext.
 
@@ -51,11 +49,10 @@
     WTF_MAKE_FAST_ALLOCATED;
     WTF_MAKE_NONCOPYABLE(PlatformContextCairo);
 public:
-    PlatformContextCairo(cairo_t*);
+    explicit PlatformContextCairo(RefPtr<cairo_t>&&);
     ~PlatformContextCairo();
 
-    cairo_t* cr() { return m_cr.get(); }
-    void setCr(cairo_t* cr) { m_cr = cr; }
+    cairo_t* cr() const { return m_cr.get(); }
 
     GraphicsContextPlatformPrivate* graphicsContextPrivate() { return m_graphicsContextPrivate; }
     void setGraphicsContextPrivate(GraphicsContextPlatformPrivate* graphicsContextPrivate) { m_graphicsContextPrivate = graphicsContextPrivate; }
@@ -86,5 +83,3 @@
 } // namespace WebCore
 
 #endif // USE(CAIRO)
-
-#endif // PlatformContextCairo_h

Modified: trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp (279459 => 279460)


--- trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp	2021-07-01 10:35:07 UTC (rev 279460)
@@ -48,11 +48,11 @@
     // Balanced by the deref in the s_bufferKey user data destroy callback.
     buffer.ref();
 
-    m_cairo.surface = adoptRef(cairo_image_surface_create_for_data(buffer.data(),
+    m_surface = adoptRef(cairo_image_surface_create_for_data(buffer.data(),
         CAIRO_FORMAT_ARGB32, buffer.size().width(), buffer.size().height(), buffer.stride()));
 
     static cairo_user_data_key_t s_bufferKey;
-    cairo_surface_set_user_data(m_cairo.surface.get(), &s_bufferKey,
+    cairo_surface_set_user_data(m_surface.get(), &s_bufferKey,
         new std::pair<Buffer*, ForPainting*> { &buffer, this },
         [](void* data)
         {
@@ -69,19 +69,15 @@
             delete userData;
         });
 
-    m_cairo.context = adoptRef(cairo_create(m_cairo.surface.get()));
-    m_platformContext = makeUnique<WebCore::PlatformContextCairo>(m_cairo.context.get());
-    m_graphicsContext = makeUnique<WebCore::GraphicsContextCairo>(*m_platformContext);
+    m_graphicsContext = makeUnique<WebCore::GraphicsContextCairo>(m_surface.get());
 }
 
 PaintingContextCairo::ForPainting::~ForPainting()
 {
-    cairo_surface_flush(m_cairo.surface.get());
+    cairo_surface_flush(m_surface.get());
 
     m_graphicsContext = nullptr;
-    m_platformContext = nullptr;
-    m_cairo.context = nullptr;
-    m_cairo.surface = nullptr;
+    m_surface = nullptr;
 
     // With all the Cairo references purged, the cairo_surface_t object should be destroyed
     // as well. This is checked by asserting that m_deletionComplete is true, which should
@@ -97,7 +93,7 @@
 
 void PaintingContextCairo::ForPainting::replay(const PaintingOperations& paintingOperations)
 {
-    PaintingOperationReplayCairo operationReplay { *m_platformContext };
+    PaintingOperationReplayCairo operationReplay { *m_graphicsContext->platformContext() };
     for (auto& operation : paintingOperations)
         operation->execute(operationReplay);
 }

Modified: trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.h (279459 => 279460)


--- trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.h	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.h	2021-07-01 10:35:07 UTC (rev 279460)
@@ -39,7 +39,6 @@
 
 namespace WebCore {
 class GraphicsContext;
-class PlatformContextCairo;
 }
 
 namespace Nicosia {
@@ -55,11 +54,7 @@
         WebCore::GraphicsContext& graphicsContext() override;
         void replay(const PaintingOperations&) override;
 
-        struct {
-            RefPtr<cairo_surface_t> surface;
-            RefPtr<cairo_t> context;
-        } m_cairo;
-        std::unique_ptr<WebCore::PlatformContextCairo> m_platformContext;
+        RefPtr<cairo_surface_t> m_surface;
         std::unique_ptr<WebCore::GraphicsContext> m_graphicsContext;
 
 #ifndef NDEBUG

Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp (279459 => 279460)


--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp	2021-07-01 10:35:07 UTC (rev 279460)
@@ -68,9 +68,14 @@
 }
 
 GraphicsContextCairo::GraphicsContextCairo(HDC dc, bool hasAlpha)
-    : GraphicsContextCairo(createCairoContextWithHDC(dc, hasAlpha).get())
+    : GraphicsContextCairo(createCairoContextWithHDC(dc, hasAlpha))
 {
 }
+
+GraphicsContextCairo::GraphicsContextCairo(PlatformContextCairo* platformContext)
+    : GraphicsContextCairo(platformContext->cr())
+{
+}
 #endif
 
 static void setRGBABitmapAlpha(unsigned char* bytes, size_t length, unsigned char level)

Modified: trunk/Source/WebCore/platform/graphics/win/ImageCairoWin.cpp (279459 => 279460)


--- trunk/Source/WebCore/platform/graphics/win/ImageCairoWin.cpp	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebCore/platform/graphics/win/ImageCairoWin.cpp	2021-07-01 10:35:07 UTC (rev 279460)
@@ -70,13 +70,10 @@
 
     unsigned char* bmpdata = (unsigned char*)bmpInfo.bmBits + bmpInfo.bmWidthBytes*(bmpInfo.bmHeight-1);
 
-    cairo_surface_t* image = cairo_image_surface_create_for_data(bmpdata, CAIRO_FORMAT_ARGB32, bmpInfo.bmWidth, bmpInfo.bmHeight, -bmpInfo.bmWidthBytes);
+    RefPtr<cairo_surface_t> image = adoptRef(cairo_image_surface_create_for_data(bmpdata, CAIRO_FORMAT_ARGB32, bmpInfo.bmWidth, bmpInfo.bmHeight, -bmpInfo.bmWidthBytes));
 
-    cairo_t* targetRef = cairo_create(image);
-    cairo_surface_destroy(image);
+    GraphicsContextCairo gc(image.get());
 
-    GraphicsContextCairo gc(targetRef);
-
     FloatSize imageSize = BitmapImage::size();
     if (size)
         drawFrameMatchingSourceSize(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), *size, CompositeOperator::Copy);
@@ -83,9 +80,6 @@
     else
         draw(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), { CompositeOperator::Copy });
 
-    // Do cleanup
-    cairo_destroy(targetRef);
-
     return true;
 }
 

Modified: trunk/Source/WebKit/ChangeLog (279459 => 279460)


--- trunk/Source/WebKit/ChangeLog	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebKit/ChangeLog	2021-07-01 10:35:07 UTC (rev 279460)
@@ -1,3 +1,17 @@
+2021-07-01  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [Cairo] Simplify GraphicsContextCairo creation
+        https://bugs.webkit.org/show_bug.cgi?id=227575
+
+        Reviewed by Žan Doberšek.
+
+        Use the new GraphicsContextCairo constructors.
+
+        * Shared/cairo/ShareableBitmapCairo.cpp:
+        (WebKit::ShareableBitmap::createGraphicsContext):
+        * UIProcess/cairo/BackingStoreCairo.cpp:
+        (WebKit::BackingStore::incorporateUpdate):
+
 2021-07-01  Jer Noble  <jer.no...@apple.com>
 
         [Mac] (Re-)enable GroupActivities after upstreaming

Modified: trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp (279459 => 279460)


--- trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp	2021-07-01 10:35:07 UTC (rev 279460)
@@ -59,8 +59,7 @@
 std::unique_ptr<GraphicsContext> ShareableBitmap::createGraphicsContext()
 {
     RefPtr<cairo_surface_t> image = createCairoSurface();
-    RefPtr<cairo_t> bitmapContext = adoptRef(cairo_create(image.get()));
-    return makeUnique<GraphicsContextCairo>(bitmapContext.get());
+    return makeUnique<GraphicsContextCairo>(image.get());
 }
 
 void ShareableBitmap::paint(GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect)

Modified: trunk/Source/WebKit/UIProcess/cairo/BackingStoreCairo.cpp (279459 => 279460)


--- trunk/Source/WebKit/UIProcess/cairo/BackingStoreCairo.cpp	2021-07-01 10:19:25 UTC (rev 279459)
+++ trunk/Source/WebKit/UIProcess/cairo/BackingStoreCairo.cpp	2021-07-01 10:35:07 UTC (rev 279460)
@@ -33,7 +33,6 @@
 #include <WebCore/BackingStoreBackendCairoImpl.h>
 #include <WebCore/CairoUtilities.h>
 #include <WebCore/GraphicsContextCairo.h>
-#include <WebCore/PlatformContextCairo.h>
 #include <WebCore/RefPtrCairo.h>
 #include <cairo.h>
 
@@ -83,8 +82,7 @@
 
     // Paint all update rects.
     IntPoint updateRectLocation = updateInfo.updateRectBounds.location();
-    RefPtr<cairo_t> cairoContext = adoptRef(cairo_create(m_backend->surface()));
-    GraphicsContextCairo graphicsContext(cairoContext.get());
+    GraphicsContextCairo graphicsContext(m_backend->surface());
 
     // When m_webPageProxy.drawsBackground() is false, bitmap contains transparent parts as a background of the webpage.
     // For such case, bitmap must be drawn using CompositeOperator::Copy to overwrite the existing surface.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to