<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GTK] Stop using glReadPixels() to blit AC surfaces in the UIProcess under Wayland"
   href="https://bugs.webkit.org/show_bug.cgi?id=161530#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GTK] Stop using glReadPixels() to blit AC surfaces in the UIProcess under Wayland"
   href="https://bugs.webkit.org/show_bug.cgi?id=161530">bug 161530</a>
              from <span class="vcard"><a class="email" href="mailto:emanuele.aina&#64;collabora.com" title="Emanuele Aina &lt;emanuele.aina&#64;collabora.com&gt;"> <span class="fn">Emanuele Aina</span></a>
</span></b>
        <pre>Flipping while rendering with the below patch and then piping through gdk_cairo_draw_from_gl() seem to work fine under Wayland as long as the display scaling factor is 1 (under X11 we should just not flip).

Weirdly when the device scaling factor is 2 (`weston --scale=2`) the page is split in two half, with the top half being drawn at the bottom and viceversa (they are otherwise correct).

+++ w/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
&#64;&#64; -224,6 +224,8 &#64;&#64; void ThreadedCompositor::renderLayerTree()
     FloatRect clipRect(0, 0, m_viewportSize.width(), m_viewportSize.height());

     TransformationMatrix viewportTransform;
+    viewportTransform.flipY();
+    viewportTransform.translate(0, -m_viewportSize.height());
     FloatPoint scrollPostion = m_viewportController-&gt;visibleContentsRect().location();
     viewportTransform.scale(m_viewportController-&gt;pageScaleFactor() * m_deviceScaleFactor);
     viewportTransform.translate(-scrollPostion.x(), -scrollPostion.y());</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>