Modified: trunk/Source/WebKit2/ChangeLog (205451 => 205452)
--- trunk/Source/WebKit2/ChangeLog 2016-09-05 13:54:25 UTC (rev 205451)
+++ trunk/Source/WebKit2/ChangeLog 2016-09-05 14:22:07 UTC (rev 205452)
@@ -1,3 +1,16 @@
+2016-09-05 Gustavo Noronha Silva <gustavo.noro...@collabora.co.uk>
+
+ [GTK] GL_PACK_ROW_LENGTH is not available in GLES2
+ https://bugs.webkit.org/show_bug.cgi?id=161484
+
+ Reviewed by Carlos Garcia Campos.
+
+ * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
+ (WebKit::AcceleratedBackingStoreWayland::paint): when under GLES2 we cannot rely on
+ GL_PACK_ROW_LENGTH; use glReadPixel directly when stride matches width, read line
+ by line manually otherwise. Colour conversion is also required to get the data out
+ correctly.
+
2016-09-05 Carlos Garcia Campos <cgar...@igalia.com>
[GTK] SetNativeSurfaceHandleForCompositing should not be compiled in for wayland build
Modified: trunk/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp (205451 => 205452)
--- trunk/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp 2016-09-05 13:54:25 UTC (rev 205451)
+++ trunk/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp 2016-09-05 14:22:07 UTC (rev 205452)
@@ -89,13 +89,28 @@
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
glPixelStorei(GL_PACK_ALIGNMENT, 4);
- glPixelStorei(GL_PACK_ROW_LENGTH, cairo_image_surface_get_stride(m_surface.get()) / 4);
+
#if USE(OPENGL_ES_2)
- glReadPixels(0, 0, textureSize.width(), textureSize.height(), GL_RGBA, GL_UNSIGNED_BYTE, cairo_image_surface_get_data(m_surface.get()));
+ unsigned char* data = ""
+ if (cairo_image_surface_get_stride(m_surface.get()) == textureSize.width() * 4)
+ glReadPixels(0, 0, textureSize.width(), textureSize.height(), GL_RGBA, GL_UNSIGNED_BYTE, data);
+ else {
+ int strideBytes = cairo_image_surface_get_stride(m_surface.get());
+ for (int i = 0; i < textureSize.height(); i++) {
+ unsigned char* dataOffset = data + i * strideBytes;
+ glReadPixels(0, i, textureSize.width(), 1, GL_RGBA, GL_UNSIGNED_BYTE, dataOffset);
+ }
+ }
+
+ // Convert to BGRA.
+ int totalBytes = size.width() * size.height() * 4;
+ for (int i = 0; i < totalBytes; i += 4)
+ std::swap(data[i], data[i + 2]);
#else
+ glPixelStorei(GL_PACK_ROW_LENGTH, cairo_image_surface_get_stride(m_surface.get()) / 4);
glReadPixels(0, 0, textureSize.width(), textureSize.height(), GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, cairo_image_surface_get_data(m_surface.get()));
+ glPixelStorei(GL_PACK_ROW_LENGTH, 0);
#endif
- glPixelStorei(GL_PACK_ROW_LENGTH, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, &fb);