[gnome-shell/gnome-3-6] shell-screen-grabber.c: Fix PBO path for big-endian machines
- From: Adel Gadllah <agadllah src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-6] shell-screen-grabber.c: Fix PBO path for big-endian machines
- Date: Mon, 12 Nov 2012 18:08:35 +0000 (UTC)
commit 980c3290de95d02a10e11c009920a7cbf20f313c
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Thu Oct 11 14:11:00 2012 -0400
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
src/shell-screen-grabber.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/shell-screen-grabber.c b/src/shell-screen-grabber.c
index 74caa89..c19bbdd 100644
--- a/src/shell-screen-grabber.c
+++ b/src/shell-screen-grabber.c
@@ -170,7 +170,16 @@ shell_screen_grabber_grab (ShellScreenGrabber *grabber,
* top-left */
glGetIntegerv (GL_VIEWPORT, vp_size);
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);
+#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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]