From: Neil Roberts Date: Sun, 8 Sep 2013 19:24:14 +0000 (+0100) Subject: nested: Add damage tracking to the nested compositor example X-Git-Tag: upstream/0.1.8~621 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=28557663335c6a50655e8b43f58cee360a1d14fc;p=profile%2Fivi%2Fweston-ivi-shell.git nested: Add damage tracking to the nested compositor example The nested compositor example now responds to damage requests and tracks them in the pending buffer state. This isn't currently used for anything and it is immediately discarded when the surface is commited but it will be used later when the example is converted to use subsurfaces. --- diff --git a/clients/nested.c b/clients/nested.c index 23be0e3..b2f5949 100644 --- a/clients/nested.c +++ b/clients/nested.c @@ -95,6 +95,9 @@ struct nested_surface { /* wl_surface.frame */ struct wl_list frame_callback_list; + + /* wl_surface.damage */ + pixman_region32_t damage; } pending; }; @@ -371,6 +374,8 @@ destroy_surface(struct wl_resource *resource) nested_buffer_reference(&surface->buffer_ref, NULL); + pixman_region32_fini(&surface->pending.damage); + wl_list_remove(&surface->link); free(surface); @@ -472,6 +477,11 @@ surface_damage(struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) { + struct nested_surface *surface = wl_resource_get_user_data(resource); + + pixman_region32_union_rect(&surface->pending.damage, + &surface->pending.damage, + x, y, width, height); } static void @@ -522,6 +532,13 @@ surface_set_input_region(struct wl_client *client, } static void +empty_region(pixman_region32_t *region) +{ + pixman_region32_fini(region); + pixman_region32_init(region); +} + +static void surface_commit(struct wl_client *client, struct wl_resource *resource) { struct nested_surface *surface = wl_resource_get_user_data(resource); @@ -537,6 +554,9 @@ surface_commit(struct wl_client *client, struct wl_resource *resource) } surface->pending.newly_attached = 0; + /* wl_surface.damage */ + empty_region(&surface->pending.damage); + /* wl_surface.frame */ wl_list_insert_list(&nested->frame_callback_list, &surface->pending.frame_callback_list); @@ -591,6 +611,7 @@ compositor_create_surface(struct wl_client *client, wl_list_init(&surface->pending.frame_callback_list); surface->pending.buffer_destroy_listener.notify = surface_handle_pending_buffer_destroy; + pixman_region32_init(&surface->pending.damage); display_acquire_window_surface(nested->display, nested->window, NULL);