Scale background pixbuf when loading.
This lets us avoid hitting the texture limit for some backgrounds.
This commit is contained in:
+4
-5
@@ -265,7 +265,6 @@ background_create(struct egl_compositor *ec,
|
|||||||
struct egl_surface *background;
|
struct egl_surface *background;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
int pixbuf_width, pixbuf_height;
|
|
||||||
void *data;
|
void *data;
|
||||||
GLenum format;
|
GLenum format;
|
||||||
|
|
||||||
@@ -275,14 +274,14 @@ background_create(struct egl_compositor *ec,
|
|||||||
|
|
||||||
g_type_init();
|
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) {
|
if (error != NULL) {
|
||||||
free(background);
|
free(background);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pixbuf_width = gdk_pixbuf_get_width(pixbuf);
|
|
||||||
pixbuf_height = gdk_pixbuf_get_height(pixbuf);
|
|
||||||
data = gdk_pixbuf_get_pixels(pixbuf);
|
data = gdk_pixbuf_get_pixels(pixbuf);
|
||||||
|
|
||||||
glGenTextures(1, &background->texture);
|
glGenTextures(1, &background->texture);
|
||||||
@@ -298,7 +297,7 @@ background_create(struct egl_compositor *ec,
|
|||||||
format = GL_RGB;
|
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);
|
format, GL_UNSIGNED_BYTE, data);
|
||||||
|
|
||||||
background->compositor = ec;
|
background->compositor = ec;
|
||||||
|
|||||||
Reference in New Issue
Block a user