[mutter/gbsneto/window-screencast-fixes: 2/2] window-actor: Clip before translate when blitting
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/window-screencast-fixes: 2/2] window-actor: Clip before translate when blitting
- Date: Tue, 17 Mar 2020 00:13:19 +0000 (UTC)
commit 04aa5f25ed1e9e1a46a24bb4a171ee9bce59a281
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Mar 16 19:55:16 2020 -0300
window-actor: Clip before translate when blitting
cogl_framebuffer_push_rectangle_clip() acts on the current modelview
matrix. That means the result of clipping then translating will be
different of the result of translating then clipping.
What we want for window screencasting if the former, not the latter.
Move the translation code (and associated) to after clipping.
Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/1097
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1129
src/compositor/meta-window-actor.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 588f639f1..9aaef213d 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -1295,13 +1295,9 @@ meta_window_actor_blit_to_framebuffer (MetaScreenCastWindow *screen_cast_window,
if (width == 0 || height == 0)
return FALSE;
- cogl_framebuffer_push_matrix (framebuffer);
-
cogl_color_init_from_4ub (&clear_color, 0, 0, 0, 0);
cogl_framebuffer_clear (framebuffer, COGL_BUFFER_BIT_COLOR, &clear_color);
cogl_framebuffer_orthographic (framebuffer, 0, 0, width, height, 0, 1.0);
- cogl_framebuffer_scale (framebuffer, resource_scale, resource_scale, 1);
- cogl_framebuffer_translate (framebuffer, -x, -y, 0);
meta_rectangle_scale_double (bounds, resource_scale,
META_ROUNDING_STRATEGY_GROW,
@@ -1318,12 +1314,16 @@ meta_window_actor_blit_to_framebuffer (MetaScreenCastWindow *screen_cast_window,
scaled_clip.x + scaled_clip.width,
scaled_clip.y + scaled_clip.height);
+ cogl_framebuffer_push_matrix (framebuffer);
+ cogl_framebuffer_scale (framebuffer, resource_scale, resource_scale, 1);
+ cogl_framebuffer_translate (framebuffer, -x, -y, 0);
+
paint_context = clutter_paint_context_new_for_framebuffer (framebuffer);
clutter_actor_paint (actor, paint_context);
clutter_paint_context_destroy (paint_context);
- cogl_framebuffer_pop_clip (framebuffer);
cogl_framebuffer_pop_matrix (framebuffer);
+ cogl_framebuffer_pop_clip (framebuffer);
cogl_framebuffer_finish (framebuffer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]