[PATCH] Use pixman_region32_clear instead of our own empty_region

Jason Ekstrand jason at jlekstrand.net
Thu Jun 26 11:16:12 PDT 2014


This requires pixman 0.25.2
---
 clients/nested.c  |  9 +--------
 configure.ac      |  2 +-
 src/compositor.c  | 15 ++++-----------
 src/data-device.c | 11 ++---------
 4 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/clients/nested.c b/clients/nested.c
index 44389e4..2a952be 100644
--- a/clients/nested.c
+++ b/clients/nested.c
@@ -551,13 +551,6 @@ 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);
@@ -574,7 +567,7 @@ surface_commit(struct wl_client *client, struct wl_resource *resource)
 	surface->pending.newly_attached = 0;
 
 	/* wl_surface.damage */
-	empty_region(&surface->pending.damage);
+	pixman_region32_clear(&surface->pending.damage);
 
 	/* wl_surface.frame */
 	wl_list_insert_list(&surface->frame_callback_list,
diff --git a/configure.ac b/configure.ac
index 648bee8..1938078 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,7 +59,7 @@ AC_CHECK_HEADERS([execinfo.h])
 
 AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
 
-COMPOSITOR_MODULES="wayland-server >= 1.3.90 pixman-1"
+COMPOSITOR_MODULES="wayland-server >= 1.3.90 pixman-1 >= 0.25.2"
 
 AC_ARG_ENABLE(egl, [  --disable-egl],,
               enable_egl=yes)
diff --git a/src/compositor.c b/src/compositor.c
index be33a36..391e635 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -320,13 +320,6 @@ weston_client_launch(struct weston_compositor *compositor,
 }
 
 static void
-empty_region(pixman_region32_t *region)
-{
-	pixman_region32_fini(region);
-	pixman_region32_init(region);
-}
-
-static void
 region_init_infinite(pixman_region32_t *region)
 {
 	pixman_region32_init_rect(region, INT32_MIN, INT32_MIN,
@@ -1599,7 +1592,7 @@ surface_flush_damage(struct weston_surface *surface)
 	    wl_shm_buffer_get(surface->buffer_ref.buffer->resource))
 		surface->compositor->renderer->flush_damage(surface);
 
-	empty_region(&surface->damage);
+	pixman_region32_clear(&surface->damage);
 }
 
 static void
@@ -2052,7 +2045,7 @@ surface_set_opaque_region(struct wl_client *client,
 		pixman_region32_copy(&surface->pending.opaque,
 				     &region->region);
 	} else {
-		empty_region(&surface->pending.opaque);
+		pixman_region32_clear(&surface->pending.opaque);
 	}
 }
 
@@ -2119,7 +2112,7 @@ weston_surface_commit_state(struct weston_surface *surface,
 			      &state->damage);
 	pixman_region32_intersect_rect(&surface->damage, &surface->damage,
 				       0, 0, surface->width, surface->height);
-	empty_region(&state->damage);
+	pixman_region32_clear(&state->damage);
 
 	/* wl_surface.set_opaque_region */
 	pixman_region32_init(&opaque);
@@ -2361,7 +2354,7 @@ weston_subsurface_commit_to_cache(struct weston_subsurface *sub)
 				  -surface->pending.sx, -surface->pending.sy);
 	pixman_region32_union(&sub->cached.damage, &sub->cached.damage,
 			      &surface->pending.damage);
-	empty_region(&surface->pending.damage);
+	pixman_region32_clear(&surface->pending.damage);
 
 	if (surface->pending.newly_attached) {
 		sub->cached.newly_attached = 1;
diff --git a/src/data-device.c b/src/data-device.c
index 88c6de3..a069b3c 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -53,13 +53,6 @@ struct weston_touch_drag {
 };
 
 static void
-empty_region(pixman_region32_t *region)
-{
-	pixman_region32_fini(region);
-	pixman_region32_init(region);
-}
-
-static void
 data_offer_accept(struct wl_client *client, struct wl_resource *resource,
 		  uint32_t serial, const char *mime_type)
 {
@@ -203,7 +196,7 @@ drag_surface_configure(struct weston_drag *drag,
 		wl_list_remove(&drag->icon->layer_link);
 		wl_list_insert(list, &drag->icon->layer_link);
 		weston_view_update_transform(drag->icon);
-		empty_region(&es->pending.input);
+		pixman_region32_clear(&es->pending.input);
 	}
 
 	drag->dx += sx;
@@ -358,7 +351,7 @@ data_device_end_drag_grab(struct weston_drag *drag,
 			weston_view_unmap(drag->icon);
 
 		drag->icon->surface->configure = NULL;
-		empty_region(&drag->icon->surface->pending.input);
+		pixman_region32_clear(&drag->icon->surface->pending.input);
 		wl_list_remove(&drag->icon_destroy_listener.link);
 		weston_view_destroy(drag->icon);
 	}
-- 
2.0.0



More information about the wayland-devel mailing list