shell-screen-grabber.c: Fix PBO path for big-endian machines

GL_BGRA/GL_UNSIGNED_BYTE only properly represents the Cairo pixel
format for little-endian machines. On big endian machines we need to use
GL_BGRA/GL_UNSIGNED_INT_8_8_8_8_REV. That would also work for little-
endian, but for minimum disruption we keep using the old version on
little endian.

https://bugzilla.gnome.org/show_bug.cgi?id=685915
This commit is contained in:
Owen W. Taylor 2012-10-11 14:11:00 -04:00 committed by Adel Gadllah
parent 2acb129505
commit 980c3290de

View File

@ -170,7 +170,16 @@ shell_screen_grabber_grab (ShellScreenGrabber *grabber,
* top-left */ * top-left */
glGetIntegerv (GL_VIEWPORT, vp_size); glGetIntegerv (GL_VIEWPORT, vp_size);
y = vp_size[3] - (y + height); y = vp_size[3] - (y + height);
/* the "big-endian" version actually works for both, but the litle-endian
* version has been better tested with a range of drivers, so we'll
* keep on using it on little-endian.
*/
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
glReadPixels (x, y, width, height, GL_BGRA, GL_UNSIGNED_BYTE, 0); glReadPixels (x, y, width, height, GL_BGRA, GL_UNSIGNED_BYTE, 0);
#else
glReadPixels (x, y, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);
#endif
mapped_data = pf_glMapBufferARB (GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB); mapped_data = pf_glMapBufferARB (GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB);