Title: [206045] trunk/Source/WebKit2
Revision
206045
Author
g...@gnome.org
Date
2016-09-16 13:46:58 -0700 (Fri, 16 Sep 2016)

Log Message

[GTK] Surface created for glReadPixels path on Wayland is bigger than needed
https://bugs.webkit.org/show_bug.cgi?id=162025

Reviewed by Carlos Garcia Campos.

* UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
(WebKit::AcceleratedBackingStoreWayland::paint): the texture created by the Wayland
compositor is already scaled, so scaling its size when creating the surface causes it
to end up bigger than necessary.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (206044 => 206045)


--- trunk/Source/WebKit2/ChangeLog	2016-09-16 20:35:16 UTC (rev 206044)
+++ trunk/Source/WebKit2/ChangeLog	2016-09-16 20:46:58 UTC (rev 206045)
@@ -1,3 +1,15 @@
+2016-09-15  Gustavo Noronha Silva  <gustavo.noro...@collabora.co.uk>
+
+        [GTK] Surface created for glReadPixels path on Wayland is bigger than needed
+        https://bugs.webkit.org/show_bug.cgi?id=162025
+
+        Reviewed by Carlos Garcia Campos.
+
+        * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
+        (WebKit::AcceleratedBackingStoreWayland::paint): the texture created by the Wayland
+        compositor is already scaled, so scaling its size when creating the surface causes it
+        to end up bigger than necessary.
+
 2016-09-16  David Kilzer  <ddkil...@apple.com>
 
         ASSERT accidentally commented out in r204916

Modified: trunk/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp (206044 => 206045)


--- trunk/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp	2016-09-16 20:35:16 UTC (rev 206044)
+++ trunk/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp	2016-09-16 20:46:58 UTC (rev 206045)
@@ -75,13 +75,10 @@
     // FIXME: Use this when GTK+ >= 3.16. GTK+ expects the Y axis to be inverted to what we get, so we need to flip it somehow.
     gdk_cairo_draw_from_gl(cr, gtk_widget_get_window(m_webPage.viewWidget()), texture, GL_TEXTURE, 1, clipRect.x(), clipRect.y(), clipRect.width(), clipRect.height());
 #else
-    IntSize size = textureSize;
-    float deviceScaleFactor = m_webPage.deviceScaleFactor();
-    size.scale(deviceScaleFactor);
+    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()));
 
-    if (!m_surface || cairo_image_surface_get_width(m_surface.get()) != size.width() || cairo_image_surface_get_height(m_surface.get()) != size.height())
-        m_surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, size.width(), size.height()));
-    cairoSurfaceSetDeviceScale(m_surface.get(), deviceScaleFactor, deviceScaleFactor);
+    cairoSurfaceSetDeviceScale(m_surface.get(), m_webPage.deviceScaleFactor(), m_webPage.deviceScaleFactor());
 
     GLuint fb;
     glGenFramebuffers(1, &fb);
@@ -103,7 +100,7 @@
     }
 
     // Convert to BGRA.
-    int totalBytes = size.width() * size.height() * 4;
+    int totalBytes = textureSize.width() * textureSize.height() * 4;
     for (int i = 0; i < totalBytes; i += 4)
         std::swap(data[i], data[i + 2]);
 #else
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to