diff options
author | Kristian Høgsberg <krh@redhat.com> | 2008-12-18 21:40:03 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2008-12-18 21:40:03 -0500 |
commit | 2d4219e54222f7bd5fd2b89f03ba5a0701b9f3e6 (patch) | |
tree | 09149b28b5f9690a1b9b6616286ff448f9fb0bac | |
parent | 18fd33c9bb4708f3009e94609e5d9b03b93f93a4 (diff) |
Scale background pixbuf when loading.
This lets us avoid hitting the texture limit for some backgrounds.
-rw-r--r-- | egl-compositor.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/egl-compositor.c b/egl-compositor.c index 5b6219d..b0e5552 100644 --- a/egl-compositor.c +++ b/egl-compositor.c @@ -265,7 +265,6 @@ background_create(struct egl_compositor *ec, struct egl_surface *background; GdkPixbuf *pixbuf; GError *error = NULL; - int pixbuf_width, pixbuf_height; void *data; GLenum format; @@ -275,14 +274,14 @@ background_create(struct egl_compositor *ec, g_type_init(); - pixbuf = gdk_pixbuf_new_from_file(filename, &error); + pixbuf = gdk_pixbuf_new_from_file_at_scale (filename, + width, height, + FALSE, &error); if (error != NULL) { free(background); return NULL; } - pixbuf_width = gdk_pixbuf_get_width(pixbuf); - pixbuf_height = gdk_pixbuf_get_height(pixbuf); data = gdk_pixbuf_get_pixels(pixbuf); glGenTextures(1, &background->texture); @@ -298,7 +297,7 @@ background_create(struct egl_compositor *ec, format = GL_RGB; } - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, pixbuf_width, pixbuf_height, 0, + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, format, GL_UNSIGNED_BYTE, data); background->compositor = ec; |