summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2008-12-18 21:05:20 -0500
committerKristian Høgsberg <krh@redhat.com>2008-12-18 21:05:20 -0500
commit18fd33c9bb4708f3009e94609e5d9b03b93f93a4 (patch)
tree0d39d8cec9dc1fb7e84aa857a94090eadd5b60c5
parente10b8285628b0265b53486e16c1fa5ebd451ecd2 (diff)
Fix rgb byte order for GdkPixbuf backgrounds.
-rw-r--r--egl-compositor.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/egl-compositor.c b/egl-compositor.c
index b24d4f2..5b6219d 100644
--- a/egl-compositor.c
+++ b/egl-compositor.c
@@ -267,6 +267,7 @@ background_create(struct egl_compositor *ec,
GError *error = NULL;
int pixbuf_width, pixbuf_height;
void *data;
+ GLenum format;
background = malloc(sizeof *background);
if (background == NULL)
@@ -290,8 +291,15 @@ background_create(struct egl_compositor *ec,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ if (gdk_pixbuf_get_has_alpha (pixbuf)) {
+ format = GL_RGBA;
+ } else {
+ format = GL_RGB;
+ }
+
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, pixbuf_width, pixbuf_height, 0,
- GL_BGR, GL_UNSIGNED_BYTE, data);
+ format, GL_UNSIGNED_BYTE, data);
background->compositor = ec;
background->map.x = 0;