[weston,v5,11/14] compositor: Add weston_layer_mask_is_infinite

Submitted by Daniel Stone on July 20, 2018, 7:03 p.m.

Details

Message ID 20180720190335.23880-12-daniels@collabora.com
State Accepted
Commit 3b7756351d31a72da11ff09c56efa17960db1b20
Headers show
Series "weston-debug API and tool" ( rev: 2 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Daniel Stone July 20, 2018, 7:03 p.m.
As a counterpart to weston_layer_set_mask_infinite(), returning if the
mask is the same as what is set.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 libweston/compositor.c | 9 +++++++++
 libweston/compositor.h | 3 +++
 2 files changed, 12 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libweston/compositor.c b/libweston/compositor.c
index 8768f67a0..0c147d4a6 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -2746,6 +2746,15 @@  weston_layer_set_mask_infinite(struct weston_layer *layer)
 				     UINT32_MAX, UINT32_MAX);
 }
 
+WL_EXPORT bool
+weston_layer_mask_is_infinite(struct weston_layer *layer)
+{
+	return layer->mask.x1 == INT32_MIN &&
+	       layer->mask.y1 == INT32_MIN &&
+	       layer->mask.x2 == INT32_MIN + UINT32_MAX &&
+	       layer->mask.y2 == INT32_MIN + UINT32_MAX;
+}
+
 WL_EXPORT void
 weston_output_schedule_repaint(struct weston_output *output)
 {
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 83448b70f..67a835713 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -1686,6 +1686,9 @@  weston_layer_set_mask(struct weston_layer *layer, int x, int y, int width, int h
 void
 weston_layer_set_mask_infinite(struct weston_layer *layer);
 
+bool
+weston_layer_mask_is_infinite(struct weston_layer *layer);
+
 void
 weston_plane_init(struct weston_plane *plane,
 			struct weston_compositor *ec,

Comments

On Fri, 20 Jul 2018 20:03:32 +0100
Daniel Stone <daniels@collabora.com> wrote:

> As a counterpart to weston_layer_set_mask_infinite(), returning if the
> mask is the same as what is set.
> 
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> ---
>  libweston/compositor.c | 9 +++++++++
>  libweston/compositor.h | 3 +++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/libweston/compositor.c b/libweston/compositor.c
> index 8768f67a0..0c147d4a6 100644
> --- a/libweston/compositor.c
> +++ b/libweston/compositor.c
> @@ -2746,6 +2746,15 @@ weston_layer_set_mask_infinite(struct weston_layer *layer)
>  				     UINT32_MAX, UINT32_MAX);
>  }
>  
> +WL_EXPORT bool
> +weston_layer_mask_is_infinite(struct weston_layer *layer)
> +{
> +	return layer->mask.x1 == INT32_MIN &&
> +	       layer->mask.y1 == INT32_MIN &&
> +	       layer->mask.x2 == INT32_MIN + UINT32_MAX &&
> +	       layer->mask.y2 == INT32_MIN + UINT32_MAX;
> +}

Hi Daniel,

I suppose this repeats what weston_layer_set_mask_infinite() does, so

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

They are both overflowing int or maybe this one is implicitly
converting a negative to unsigned, but I believe it works in practice.
Wonder if Clang would disagree.


Thanks,
pq

> +
>  WL_EXPORT void
>  weston_output_schedule_repaint(struct weston_output *output)
>  {
> diff --git a/libweston/compositor.h b/libweston/compositor.h
> index 83448b70f..67a835713 100644
> --- a/libweston/compositor.h
> +++ b/libweston/compositor.h
> @@ -1686,6 +1686,9 @@ weston_layer_set_mask(struct weston_layer *layer, int x, int y, int width, int h
>  void
>  weston_layer_set_mask_infinite(struct weston_layer *layer);
>  
> +bool
> +weston_layer_mask_is_infinite(struct weston_layer *layer);
> +
>  void
>  weston_plane_init(struct weston_plane *plane,
>  			struct weston_compositor *ec,