From ebc07871eb5043a856f2698bb6320a5ef7dd521d Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 3 Feb 2020 14:18:57 +0100 Subject: [PATCH] shaped-texture: Add `get_width()`/`get_height()` API Add an API to retrieve the content size of a shaped texture. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1022 --- src/compositor/meta-shaped-texture-private.h | 3 +++ src/compositor/meta-shaped-texture.c | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/compositor/meta-shaped-texture-private.h b/src/compositor/meta-shaped-texture-private.h index e96c6f8a8..85d94b753 100644 --- a/src/compositor/meta-shaped-texture-private.h +++ b/src/compositor/meta-shaped-texture-private.h @@ -63,4 +63,7 @@ gboolean meta_shaped_texture_update_area (MetaShapedTexture *stex, int height, cairo_rectangle_int_t *clip); +int meta_shaped_texture_get_width (MetaShapedTexture *stex); +int meta_shaped_texture_get_height (MetaShapedTexture *stex); + #endif diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c index 5847408a0..85a5143f9 100644 --- a/src/compositor/meta-shaped-texture.c +++ b/src/compositor/meta-shaped-texture.c @@ -1437,3 +1437,23 @@ meta_shaped_texture_get_buffer_scale (MetaShapedTexture *stex) return stex->buffer_scale; } + +int +meta_shaped_texture_get_width (MetaShapedTexture *stex) +{ + g_return_val_if_fail (META_IS_SHAPED_TEXTURE (stex), 0); + + ensure_size_valid (stex); + + return stex->dst_width; +} + +int +meta_shaped_texture_get_height (MetaShapedTexture *stex) +{ + g_return_val_if_fail (META_IS_SHAPED_TEXTURE (stex), 0); + + ensure_size_valid (stex); + + return stex->dst_height; +}