From 01d147a2d7e0204075051ba35f0a85f83254f294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 19 Dec 2018 11:55:43 +0100 Subject: [PATCH] compositor: Make meta_actor_painting_untransformed take a framebuffer Stop using the cogl draw framebuffer implicitly. https://gitlab.gnome.org/GNOME/mutter/merge_requests/362 --- src/compositor/clutter-utils.c | 9 +++++---- src/compositor/clutter-utils.h | 9 +++++---- src/compositor/meta-background-actor.c | 7 ++++++- src/compositor/meta-shaped-texture.c | 7 +++++-- src/compositor/meta-window-group.c | 6 +++++- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/compositor/clutter-utils.c b/src/compositor/clutter-utils.c index fb74732ce..6591ee2d3 100644 --- a/src/compositor/clutter-utils.c +++ b/src/compositor/clutter-utils.c @@ -143,7 +143,8 @@ meta_actor_is_untransformed (ClutterActor *actor, * transform. */ gboolean -meta_actor_painting_untransformed (int paint_width, +meta_actor_painting_untransformed (CoglFramebuffer *fb, + int paint_width, int paint_height, int *x_origin, int *y_origin) @@ -153,8 +154,8 @@ meta_actor_painting_untransformed (int paint_width, float viewport[4]; int i; - cogl_get_modelview_matrix (&modelview); - cogl_get_projection_matrix (&projection); + cogl_framebuffer_get_modelview_matrix (fb, &modelview); + cogl_framebuffer_get_projection_matrix (fb, &projection); cogl_matrix_multiply (&modelview_projection, &projection, @@ -173,7 +174,7 @@ meta_actor_painting_untransformed (int paint_width, vertices[3].y = paint_height; vertices[3].z = 0; - cogl_get_viewport (viewport); + cogl_framebuffer_get_viewport4fv (fb, viewport); for (i = 0; i < 4; i++) { diff --git a/src/compositor/clutter-utils.h b/src/compositor/clutter-utils.h index 36a5925cf..b96733e4a 100644 --- a/src/compositor/clutter-utils.h +++ b/src/compositor/clutter-utils.h @@ -31,9 +31,10 @@ gboolean meta_actor_is_untransformed (ClutterActor *actor, int *x_origin, int *y_origin); -gboolean meta_actor_painting_untransformed (int paint_width, - int paint_height, - int *x_origin, - int *y_origin); +gboolean meta_actor_painting_untransformed (CoglFramebuffer *fb, + int paint_width, + int paint_height, + int *x_origin, + int *y_origin); #endif /* __META_CLUTTER_UTILS_H__ */ diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c index 197a62c0f..c4c0f9561 100644 --- a/src/compositor/meta-background-actor.c +++ b/src/compositor/meta-background-actor.c @@ -325,6 +325,7 @@ setup_pipeline (MetaBackgroundActor *self, PipelineFlags pipeline_flags = 0; guint8 opacity; float color_component; + CoglFramebuffer *fb; CoglPipelineFilter filter; opacity = clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self)); @@ -417,8 +418,12 @@ setup_pipeline (MetaBackgroundActor *self, color_component, opacity / 255.); + fb = cogl_get_draw_framebuffer (); if (!priv->force_bilinear && - meta_actor_painting_untransformed (actor_pixel_rect->width, actor_pixel_rect->height, NULL, NULL)) + meta_actor_painting_untransformed (fb, + actor_pixel_rect->width, + actor_pixel_rect->height, + NULL, NULL)) filter = COGL_PIPELINE_FILTER_NEAREST; else filter = COGL_PIPELINE_FILTER_LINEAR; diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c index 98346c6ae..133041ba9 100644 --- a/src/compositor/meta-shaped-texture.c +++ b/src/compositor/meta-shaped-texture.c @@ -422,17 +422,20 @@ meta_shaped_texture_paint (ClutterActor *actor) cairo_rectangle_int_t tex_rect = { 0, 0, tex_width, tex_height }; + fb = cogl_get_draw_framebuffer (); + /* Use nearest-pixel interpolation if the texture is unscaled. This * improves performance, especially with software rendering. */ filter = COGL_PIPELINE_FILTER_LINEAR; - if (meta_actor_painting_untransformed (tex_width, tex_height, NULL, NULL)) + if (meta_actor_painting_untransformed (fb, + tex_width, tex_height, + NULL, NULL)) filter = COGL_PIPELINE_FILTER_NEAREST; ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ()); - fb = cogl_get_draw_framebuffer (); opacity = clutter_actor_get_paint_opacity (actor); clutter_actor_get_allocation_box (actor, &alloc); diff --git a/src/compositor/meta-window-group.c b/src/compositor/meta-window-group.c index 665adee77..d41c00783 100644 --- a/src/compositor/meta-window-group.c +++ b/src/compositor/meta-window-group.c @@ -81,7 +81,11 @@ meta_window_group_paint (ClutterActor *actor) */ if (clutter_actor_is_in_clone_paint (actor)) { - if (!meta_actor_painting_untransformed (screen_width, + CoglFramebuffer *fb; + + fb = cogl_get_draw_framebuffer (); + if (!meta_actor_painting_untransformed (fb, + screen_width, screen_height, &paint_x_origin, &paint_y_origin) ||