compositor: Destroy gles2 resource for weston_surface in gles2-renderer.c

This moves the last gles2 call out of compositor.c.
Kristian Høgsberg 12 years ago
parent 3a0de88abf
commit 4226385e53
  1. 8
      src/compositor.c
  2. 1
      src/compositor.h
  3. 13
      src/gles2-renderer.c

@ -682,8 +682,6 @@ struct weston_frame_callback {
static void
destroy_surface(struct wl_resource *resource)
{
int i;
struct weston_surface *surface =
container_of(resource,
struct weston_surface, surface.resource);
@ -693,14 +691,10 @@ destroy_surface(struct wl_resource *resource)
if (weston_surface_is_mapped(surface))
weston_surface_unmap(surface);
glDeleteTextures(surface->num_textures, surface->textures);
if (surface->buffer)
wl_list_remove(&surface->buffer_destroy_listener.link);
for (i = 0; i < surface->num_images; i++)
compositor->destroy_image(compositor->egl_display,
surface->images[i]);
compositor->renderer->destroy_surface(surface);
pixman_region32_fini(&surface->transform.boundingbox);
pixman_region32_fini(&surface->damage);

@ -272,6 +272,7 @@ struct weston_renderer {
pixman_region32_t *output_damage);
void (*flush_damage)(struct weston_surface *surface);
void (*attach)(struct weston_surface *es, struct wl_buffer *buffer);
void (*destroy_surface)(struct weston_surface *surface);
};
struct weston_compositor {

@ -821,6 +821,18 @@ gles2_renderer_attach(struct weston_surface *es, struct wl_buffer *buffer)
}
}
static void
gles2_renderer_destroy_surface(struct weston_surface *surface)
{
struct weston_compositor *ec = surface->compositor;
int i;
glDeleteTextures(surface->num_textures, surface->textures);
for (i = 0; i < surface->num_images; i++)
ec->destroy_image(ec->egl_display, surface->images[i]);
}
static const char vertex_shader[] =
"uniform mat4 proj;\n"
"attribute vec2 position;\n"
@ -1164,6 +1176,7 @@ gles2_renderer_init(struct weston_compositor *ec)
renderer->base.repaint_output = gles2_renderer_repaint_output;
renderer->base.flush_damage = gles2_renderer_flush_damage;
renderer->base.attach = gles2_renderer_attach;
renderer->base.destroy_surface = gles2_renderer_destroy_surface;
ec->renderer = &renderer->base;
return 0;

Loading…
Cancel
Save