Title: [267398] trunk/Source
Revision
267398
Author
[email protected]
Date
2020-09-21 23:08:19 -0700 (Mon, 21 Sep 2020)

Log Message

[GTK] Bump cairo version to support HiDPI
https://bugs.webkit.org/show_bug.cgi?id=133378

Reviewed by Carlos Garcia Campos.

Remove conditional compilation around cairo_{g,s}et_device_scale() as there is no need to
support older versions of Cairo which lack the functions. The minimum version of Cairo
being required by CMake is 1.14.0, which already includes them.

Source/WebCore:

No new tests needed.

* platform/graphics/cairo/BackingStoreBackendCairoImpl.cpp:
(WebCore::createCairoImageSurfaceWithFastMalloc): Use cairo_surface_set_device_scale()
directly.
(WebCore::BackingStoreBackendCairoImpl::scroll): Use cairo_surface_get_device_scale()
directly.
* platform/graphics/cairo/BackingStoreBackendCairoX11.cpp:
(WebCore::BackingStoreBackendCairoX11::BackingStoreBackendCairoX11): Use
cairo_surface_set_device_scale() directly.
(WebCore::BackingStoreBackendCairoX11::scroll): Use cairo_surface_get_device_scale()
directly.
* platform/graphics/cairo/CairoUtilities.cpp: Remove helper functions
cairoSurfaceSetDeviceScale() and cairoSurfaceGetDeviceScale().
* platform/graphics/cairo/CairoUtilities.h: Ditto.

Source/WebKit:

* Shared/cairo/ShareableBitmapCairo.cpp:
(WebKit::ShareableBitmap::paint): use cairo_surface_set_device_scale() directly.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseTakeViewSnapshot): Ditto.
* UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
(WebKit::AcceleratedBackingStoreWayland::displayBuffer): Ditto.
(WebKit::AcceleratedBackingStoreWayland::downloadTexture): Ditto.
* UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
(WebKit::AcceleratedBackingStoreX11::update): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (267397 => 267398)


--- trunk/Source/WebCore/ChangeLog	2020-09-22 05:07:13 UTC (rev 267397)
+++ trunk/Source/WebCore/ChangeLog	2020-09-22 06:08:19 UTC (rev 267398)
@@ -1,3 +1,30 @@
+2020-09-21  Adrian Perez de Castro  <[email protected]>
+
+        [GTK] Bump cairo version to support HiDPI
+        https://bugs.webkit.org/show_bug.cgi?id=133378
+
+        Reviewed by Carlos Garcia Campos.
+
+        Remove conditional compilation around cairo_{g,s}et_device_scale() as there is no need to
+        support older versions of Cairo which lack the functions. The minimum version of Cairo
+        being required by CMake is 1.14.0, which already includes them.
+
+        No new tests needed.
+
+        * platform/graphics/cairo/BackingStoreBackendCairoImpl.cpp:
+        (WebCore::createCairoImageSurfaceWithFastMalloc): Use cairo_surface_set_device_scale()
+        directly.
+        (WebCore::BackingStoreBackendCairoImpl::scroll): Use cairo_surface_get_device_scale()
+        directly.
+        * platform/graphics/cairo/BackingStoreBackendCairoX11.cpp:
+        (WebCore::BackingStoreBackendCairoX11::BackingStoreBackendCairoX11): Use
+        cairo_surface_set_device_scale() directly.
+        (WebCore::BackingStoreBackendCairoX11::scroll): Use cairo_surface_get_device_scale()
+        directly.
+        * platform/graphics/cairo/CairoUtilities.cpp: Remove helper functions
+        cairoSurfaceSetDeviceScale() and cairoSurfaceGetDeviceScale().
+        * platform/graphics/cairo/CairoUtilities.h: Ditto.
+
 2020-09-21  Tim Horton  <[email protected]>
 
         paper.io ad close buttons cannot be iteracted with via trackpad on iPad

Modified: trunk/Source/WebCore/platform/graphics/cairo/BackingStoreBackendCairoImpl.cpp (267397 => 267398)


--- trunk/Source/WebCore/platform/graphics/cairo/BackingStoreBackendCairoImpl.cpp	2020-09-22 05:07:13 UTC (rev 267397)
+++ trunk/Source/WebCore/platform/graphics/cairo/BackingStoreBackendCairoImpl.cpp	2020-09-22 06:08:19 UTC (rev 267398)
@@ -35,7 +35,7 @@
     auto* surfaceData = fastZeroedMalloc(size.height() * stride);
     RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create_for_data(static_cast<unsigned char*>(surfaceData), CAIRO_FORMAT_ARGB32, size.width(), size.height(), stride));
     cairo_surface_set_user_data(surface.get(), &s_surfaceDataKey, surfaceData, [](void* data) { fastFree(data); });
-    cairoSurfaceSetDeviceScale(surface.get(), deviceScaleFactor, deviceScaleFactor);
+    cairo_surface_set_device_scale(surface.get(), deviceScaleFactor, deviceScaleFactor);
     return surface;
 }
 
@@ -61,7 +61,7 @@
     if (!m_scrollSurface) {
         IntSize size(cairo_image_surface_get_width(m_surface.get()), cairo_image_surface_get_height(m_surface.get()));
         double xScale, yScale;
-        cairoSurfaceGetDeviceScale(m_surface.get(), xScale, yScale);
+        cairo_surface_get_device_scale(m_surface.get(), &xScale, &yScale);
         ASSERT(xScale == yScale);
         m_scrollSurface = createCairoImageSurfaceWithFastMalloc(size, xScale);
     }

Modified: trunk/Source/WebCore/platform/graphics/cairo/BackingStoreBackendCairoX11.cpp (267397 => 267398)


--- trunk/Source/WebCore/platform/graphics/cairo/BackingStoreBackendCairoX11.cpp	2020-09-22 05:07:13 UTC (rev 267397)
+++ trunk/Source/WebCore/platform/graphics/cairo/BackingStoreBackendCairoX11.cpp	2020-09-22 06:08:19 UTC (rev 267398)
@@ -37,7 +37,7 @@
     m_gc.reset(XCreateGC(display, m_pixmap.get(), 0, nullptr));
 
     m_surface = adoptRef(cairo_xlib_surface_create(display, m_pixmap.get(), visual, scaledSize.width(), scaledSize.height()));
-    cairoSurfaceSetDeviceScale(m_surface.get(), deviceScaleFactor, deviceScaleFactor);
+    cairo_surface_set_device_scale(m_surface.get(), deviceScaleFactor, deviceScaleFactor);
 }
 
 BackingStoreBackendCairoX11::~BackingStoreBackendCairoX11()
@@ -55,7 +55,7 @@
         return;
 
     double xScale, yScale;
-    cairoSurfaceGetDeviceScale(m_surface.get(), xScale, yScale);
+    cairo_surface_get_device_scale(m_surface.get(), &xScale, &yScale);
     ASSERT(xScale == yScale);
 
     IntSize scaledScrollOffset = scrollOffset;

Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp (267397 => 267398)


--- trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp	2020-09-22 05:07:13 UTC (rev 267397)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp	2020-09-22 06:08:19 UTC (rev 267398)
@@ -361,29 +361,6 @@
     }
 }
 
-void cairoSurfaceSetDeviceScale(cairo_surface_t* surface, double xScale, double yScale)
-{
-    // This function was added pretty much simultaneous to when 1.13 was branched.
-#if HAVE(CAIRO_SURFACE_SET_DEVICE_SCALE)
-    cairo_surface_set_device_scale(surface, xScale, yScale);
-#else
-    UNUSED_PARAM(surface);
-    ASSERT_UNUSED(xScale, 1 == xScale);
-    ASSERT_UNUSED(yScale, 1 == yScale);
-#endif
-}
-
-void cairoSurfaceGetDeviceScale(cairo_surface_t* surface, double& xScale, double& yScale)
-{
-#if HAVE(CAIRO_SURFACE_SET_DEVICE_SCALE)
-    cairo_surface_get_device_scale(surface, &xScale, &yScale);
-#else
-    UNUSED_PARAM(surface);
-    xScale = 1;
-    yScale = 1;
-#endif
-}
-
 RefPtr<cairo_region_t> toCairoRegion(const Region& region)
 {
     RefPtr<cairo_region_t> cairoRegion = adoptRef(cairo_region_create());

Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h (267397 => 267398)


--- trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h	2020-09-22 05:07:13 UTC (rev 267397)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h	2020-09-22 06:08:19 UTC (rev 267398)
@@ -32,9 +32,6 @@
 #include "IntSize.h"
 #include <cairo.h>
 
-// This function was added pretty much simultaneous to when 1.13 was branched.
-#define HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE CAIRO_VERSION_MAJOR > 1 || (CAIRO_VERSION_MAJOR == 1 && CAIRO_VERSION_MINOR >= 13)
-
 #if USE(FREETYPE)
 #include <cairo-ft.h>
 #endif
@@ -92,8 +89,6 @@
 
 IntSize cairoSurfaceSize(cairo_surface_t*);
 void flipImageSurfaceVertically(cairo_surface_t*);
-void cairoSurfaceSetDeviceScale(cairo_surface_t*, double xScale, double yScale);
-void cairoSurfaceGetDeviceScale(cairo_surface_t*, double& xScale, double& yScale);
 
 RefPtr<cairo_region_t> toCairoRegion(const Region&);
 

Modified: trunk/Source/WebKit/ChangeLog (267397 => 267398)


--- trunk/Source/WebKit/ChangeLog	2020-09-22 05:07:13 UTC (rev 267397)
+++ trunk/Source/WebKit/ChangeLog	2020-09-22 06:08:19 UTC (rev 267398)
@@ -1,3 +1,24 @@
+2020-09-21  Adrian Perez de Castro  <[email protected]>
+
+        [GTK] Bump cairo version to support HiDPI
+        https://bugs.webkit.org/show_bug.cgi?id=133378
+
+        Reviewed by Carlos Garcia Campos.
+
+        Remove conditional compilation around cairo_{g,s}et_device_scale() as there is no need to
+        support older versions of Cairo which lack the functions. The minimum version of Cairo
+        being required by CMake is 1.14.0, which already includes them.
+
+        * Shared/cairo/ShareableBitmapCairo.cpp:
+        (WebKit::ShareableBitmap::paint): use cairo_surface_set_device_scale() directly.
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseTakeViewSnapshot): Ditto.
+        * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
+        (WebKit::AcceleratedBackingStoreWayland::displayBuffer): Ditto.
+        (WebKit::AcceleratedBackingStoreWayland::downloadTexture): Ditto.
+        * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
+        (WebKit::AcceleratedBackingStoreX11::update): Ditto.
+
 2020-09-21  Tim Horton  <[email protected]>
 
         paper.io ad close buttons cannot be iteracted with via trackpad on iPad

Modified: trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp (267397 => 267398)


--- trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp	2020-09-22 05:07:13 UTC (rev 267397)
+++ trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp	2020-09-22 06:08:19 UTC (rev 267398)
@@ -71,7 +71,7 @@
 void ShareableBitmap::paint(GraphicsContext& context, float scaleFactor, const IntPoint& dstPoint, const IntRect& srcRect)
 {
     RefPtr<cairo_surface_t> surface = createSurfaceFromData(data(), m_size);
-    cairoSurfaceSetDeviceScale(surface.get(), scaleFactor, scaleFactor);
+    cairo_surface_set_device_scale(surface.get(), scaleFactor, scaleFactor);
     FloatRect destRect(dstPoint, srcRect.size());
 
     ASSERT(context.hasPlatformContext());

Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp (267397 => 267398)


--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp	2020-09-22 05:07:13 UTC (rev 267397)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp	2020-09-22 06:08:19 UTC (rev 267398)
@@ -2341,7 +2341,7 @@
     size.scale(deviceScale);
 
     RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_RGB24, size.width(), size.height()));
-    cairoSurfaceSetDeviceScale(surface.get(), deviceScale, deviceScale);
+    cairo_surface_set_device_scale(surface.get(), deviceScale, deviceScale);
 
     RefPtr<cairo_t> cr = adoptRef(cairo_create(surface.get()));
     if (clipRect) {

Modified: trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp (267397 => 267398)


--- trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp	2020-09-22 05:07:13 UTC (rev 267397)
+++ trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp	2020-09-22 06:08:19 UTC (rev 267398)
@@ -401,7 +401,7 @@
         cairo_surface_set_user_data(m_surface.get(), &s_surfaceDataKey, surfaceData, [](void* data) {
             fastFree(data);
         });
-        cairoSurfaceSetDeviceScale(m_surface.get(), m_webPage.deviceScaleFactor(), m_webPage.deviceScaleFactor());
+        cairo_surface_set_device_scale(m_surface.get(), m_webPage.deviceScaleFactor(), m_webPage.deviceScaleFactor());
     }
 
     unsigned char* surfaceData = cairo_image_surface_get_data(m_surface.get());
@@ -472,7 +472,7 @@
     if (!m_surface || cairo_image_surface_get_width(m_surface.get()) != textureSize.width() || cairo_image_surface_get_height(m_surface.get()) != textureSize.height())
         m_surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, textureSize.width(), textureSize.height()));
 
-    cairoSurfaceSetDeviceScale(m_surface.get(), m_webPage.deviceScaleFactor(), m_webPage.deviceScaleFactor());
+    cairo_surface_set_device_scale(m_surface.get(), m_webPage.deviceScaleFactor(), m_webPage.deviceScaleFactor());
 
     GLuint fb;
     glGenFramebuffers(1, &fb);

Modified: trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp (267397 => 267398)


--- trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp	2020-09-22 05:07:13 UTC (rev 267397)
+++ trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp	2020-09-22 06:08:19 UTC (rev 267398)
@@ -209,7 +209,7 @@
     auto* visual = GDK_VISUAL_XVISUAL(gdkVisual);
 #endif
     m_surface = adoptRef(cairo_xlib_surface_create(display, pixmap, visual, size.width(), size.height()));
-    WebCore::cairoSurfaceSetDeviceScale(m_surface.get(), deviceScaleFactor, deviceScaleFactor);
+    cairo_surface_set_device_scale(m_surface.get(), deviceScaleFactor, deviceScaleFactor);
     m_damage = XDamageCreate(display, pixmap, XDamageReportNonEmpty);
     XDamageNotifier::singleton().add(m_damage.get(), [this] {
         if (m_webPage.isViewVisible())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to