mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
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 is 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
This commit is contained in:
parent
82778f72a4
commit
cdd27d0e53
@ -1292,13 +1292,9 @@ meta_window_actor_blit_to_framebuffer (MetaScreenCastWindow *screen_cast_window,
|
||||
|
||||
clutter_actor_get_position (actor, &x, &y);
|
||||
|
||||
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,
|
||||
@ -1315,12 +1311,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);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user