summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-02-03 21:54:26 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-02-03 21:54:26 +0100
commitacf2d4d38df8732ab15b28c40abdf436af1bf748 (patch)
treee46d179b01ffee98e478e0d65eb83c33e8ab66df
parent33cb1b120c1a1ad8007b7fbb1ed341dc7b347703 (diff)
pixmap-surface: reduce buffer cretion on resize
This is done by creating ne EGLsurfaces in redraw not in configure.
-rw-r--r--egl-wayland-pixmap-surface.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/egl-wayland-pixmap-surface.c b/egl-wayland-pixmap-surface.c
index a153561..8f939b1 100644
--- a/egl-wayland-pixmap-surface.c
+++ b/egl-wayland-pixmap-surface.c
@@ -132,6 +132,12 @@ redraw(void *data, uint32_t time)
if (start_time == 0)
start_time = time;
+ if (window->egl.surf == NULL) {
+ wl_egl_native_pixmap_destroy(window->egl_pixmap);
+ create_egl_surface(window->display, window);
+ glViewport(0, 0, window->width, window->height);
+ }
+
glClearColor(0.0, 0.0, 0.0, 0.5);
glClear(GL_COLOR_BUFFER_BIT);
@@ -211,18 +217,17 @@ handle_configure(void *data, struct wl_shell *shell,
dy = window->attached_height - height;
//wl_egl_surface_resize(window->egl_surface, width, height, dx, dy);
- struct wl_egl_pixmap *old_pixmap = window->egl_pixmap;
- EGLSurface old_egl_surf = window->egl.surf;
if (window->buffer) {
wl_buffer_destroy(window->buffer);
window->buffer = NULL;
}
- create_egl_surface(d, window);
- eglDestroySurface(d->egl.dpy, old_egl_surf);
- wl_egl_native_pixmap_destroy(old_pixmap);
+ if (window->egl.surf) {
+ eglDestroySurface(d->egl.dpy, window->egl.surf);
+ window->egl.surf = NULL;
+ }
window->dx = dx;
@@ -230,7 +235,6 @@ handle_configure(void *data, struct wl_shell *shell,
window->width = width;
window->height = height;
- glViewport(0, 0, window->width, window->height);
}
static const struct wl_shell_listener wayland_shell_listener = {