[mutter] screen-cast-window: Use buffer bounds in place of frame bounds
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] screen-cast-window: Use buffer bounds in place of frame bounds
- Date: Tue, 11 Feb 2020 13:18:29 +0000 (UTC)
commit 0f58c98386351c5d980ddfe04309e9598e4eb1f5
Author: Olivier Fourdan <ofourdan redhat com>
Date: Tue Jan 28 11:13:41 2020 +0100
screen-cast-window: Use buffer bounds in place of frame bounds
The frame bounds as returned by `meta_window_actor_get_frame_bounds()`
would be used as cropping values when streaming a window content.
But, as its name implies, it returns the actual frame bounds, whereas we
may want to include the whole buffer, to include client side shadows for
example.
Rename the `get_frame_bounds()` API to `get_buffer_bounds()` (which was
previously partly removed with commit 11bd84789) and return the actual
buffer bounds to use as the cropping area when streaming a window.
Fixes: 931934511 - "Implement MetaScreenCastWindow interface"
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1022
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/1018
src/backends/meta-screen-cast-window-stream-src.c | 4 ++--
src/backends/meta-screen-cast-window.c | 8 ++++----
src/backends/meta-screen-cast-window.h | 8 ++++----
src/compositor/meta-window-actor.c | 24 ++++++++---------------
4 files changed, 18 insertions(+), 26 deletions(-)
---
diff --git a/src/backends/meta-screen-cast-window-stream-src.c
b/src/backends/meta-screen-cast-window-stream-src.c
index f77060d6e..63ac5eb38 100644
--- a/src/backends/meta-screen-cast-window-stream-src.c
+++ b/src/backends/meta-screen-cast-window-stream-src.c
@@ -230,8 +230,8 @@ meta_screen_cast_window_stream_src_get_videocrop (MetaScreenCastStreamSrc *src,
META_SCREEN_CAST_WINDOW_STREAM_SRC (src);
MetaRectangle stream_rect;
- meta_screen_cast_window_get_frame_bounds (window_src->screen_cast_window,
- crop_rect);
+ meta_screen_cast_window_get_buffer_bounds (window_src->screen_cast_window,
+ crop_rect);
stream_rect.x = 0;
stream_rect.y = 0;
diff --git a/src/backends/meta-screen-cast-window.c b/src/backends/meta-screen-cast-window.c
index 809aca9be..bc6249a47 100644
--- a/src/backends/meta-screen-cast-window.c
+++ b/src/backends/meta-screen-cast-window.c
@@ -30,11 +30,11 @@ meta_screen_cast_window_default_init (MetaScreenCastWindowInterface *iface)
}
void
-meta_screen_cast_window_get_frame_bounds (MetaScreenCastWindow *screen_cast_window,
- MetaRectangle *bounds)
+meta_screen_cast_window_get_buffer_bounds (MetaScreenCastWindow *screen_cast_window,
+ MetaRectangle *bounds)
{
- META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window)->get_frame_bounds (screen_cast_window,
- bounds);
+ META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window)->get_buffer_bounds (screen_cast_window,
+ bounds);
}
void
diff --git a/src/backends/meta-screen-cast-window.h b/src/backends/meta-screen-cast-window.h
index b836fec5c..28734d8fb 100644
--- a/src/backends/meta-screen-cast-window.h
+++ b/src/backends/meta-screen-cast-window.h
@@ -37,8 +37,8 @@ struct _MetaScreenCastWindowInterface
{
GTypeInterface parent_iface;
- void (*get_frame_bounds) (MetaScreenCastWindow *screen_cast_window,
- MetaRectangle *bounds);
+ void (*get_buffer_bounds) (MetaScreenCastWindow *screen_cast_window,
+ MetaRectangle *bounds);
void (*transform_relative_position) (MetaScreenCastWindow *screen_cast_window,
double x,
@@ -59,8 +59,8 @@ struct _MetaScreenCastWindowInterface
gboolean (*has_damage) (MetaScreenCastWindow *screen_cast_window);
};
-void meta_screen_cast_window_get_frame_bounds (MetaScreenCastWindow *screen_cast_window,
- MetaRectangle *bounds);
+void meta_screen_cast_window_get_buffer_bounds (MetaScreenCastWindow *screen_cast_window,
+ MetaRectangle *bounds);
void meta_screen_cast_window_transform_relative_position (MetaScreenCastWindow *screen_cast_window,
double x,
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 8ce6bc609..1e38badd6 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -1138,29 +1138,21 @@ meta_window_actor_get_geometry_scale (MetaWindowActor *window_actor)
}
static void
-meta_window_actor_get_frame_bounds (MetaScreenCastWindow *screen_cast_window,
- MetaRectangle *bounds)
+meta_window_actor_get_buffer_bounds (MetaScreenCastWindow *screen_cast_window,
+ MetaRectangle *bounds)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (screen_cast_window);
MetaWindowActorPrivate *priv =
meta_window_actor_get_instance_private (window_actor);
- MetaWindow *window;
MetaShapedTexture *stex;
- MetaRectangle buffer_rect;
- MetaRectangle frame_rect;
int buffer_scale;
stex = meta_surface_actor_get_texture (priv->surface);
buffer_scale = meta_shaped_texture_get_buffer_scale (stex);
-
- window = priv->window;
- meta_window_get_buffer_rect (window, &buffer_rect);
- meta_window_get_frame_rect (window, &frame_rect);
-
- bounds->x = (int) floor ((frame_rect.x - buffer_rect.x) / (float) buffer_scale);
- bounds->y = (int) floor ((frame_rect.y - buffer_rect.y) / (float) buffer_scale);
- bounds->width = (int) ceil (frame_rect.width / (float) buffer_scale);
- bounds->height = (int) ceil (frame_rect.height / (float) buffer_scale);
+ *bounds = (MetaRectangle) {
+ .width = meta_shaped_texture_get_width (stex) * buffer_scale,
+ .height = meta_shaped_texture_get_height (stex) * buffer_scale,
+ };
}
static void
@@ -1177,7 +1169,7 @@ meta_window_actor_transform_relative_position (MetaScreenCastWindow *screen_cast
MetaRectangle bounds;
graphene_point3d_t v1 = { 0.f, }, v2 = { 0.f, };
- meta_window_actor_get_frame_bounds (screen_cast_window, &bounds);
+ meta_window_actor_get_buffer_bounds (screen_cast_window, &bounds);
v1.x = CLAMP ((float) x,
bounds.x,
@@ -1302,7 +1294,7 @@ meta_window_actor_has_damage (MetaScreenCastWindow *screen_cast_window)
static void
screen_cast_window_iface_init (MetaScreenCastWindowInterface *iface)
{
- iface->get_frame_bounds = meta_window_actor_get_frame_bounds;
+ iface->get_buffer_bounds = meta_window_actor_get_buffer_bounds;
iface->transform_relative_position = meta_window_actor_transform_relative_position;
iface->transform_cursor_position = meta_window_actor_transform_cursor_position;
iface->capture_into = meta_window_actor_capture_into;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]