clutter/paint-context: Allow passing redraw clip to offscreen paint context

So that we can mark the redraw clip of the part of the stage we're
painting.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1207
This commit is contained in:
Jonas Ådahl 2020-04-20 21:13:38 +02:00
parent 1b33a5a3a7
commit a4f55d4986
4 changed files with 11 additions and 7 deletions

View File

@ -60,13 +60,15 @@ clutter_paint_context_new_for_view (ClutterStageView *view,
* clutter_paint_context_new_for_framebuffer: (skip)
*/
ClutterPaintContext *
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
ClutterPaintFlag paint_flags)
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
const cairo_region_t *redraw_clip,
ClutterPaintFlag paint_flags)
{
ClutterPaintContext *paint_context;
paint_context = g_new0 (ClutterPaintContext, 1);
g_ref_count_init (&paint_context->ref_count);
paint_context->redraw_clip = cairo_region_copy (redraw_clip);
paint_context->paint_flags = paint_flags;
clutter_paint_context_push_framebuffer (paint_context, framebuffer);

View File

@ -40,8 +40,9 @@ CLUTTER_EXPORT
GType clutter_paint_context_get_type (void);
CLUTTER_EXPORT
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
ClutterPaintFlag paint_flags);
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
const cairo_region_t *redraw_clip,
ClutterPaintFlag paint_flags);
CLUTTER_EXPORT
ClutterPaintContext * clutter_paint_context_ref (ClutterPaintContext *paint_context);

View File

@ -1271,7 +1271,8 @@ get_image_via_offscreen (MetaShapedTexture *stex,
clutter_paint_node_set_static_name (root_node, "MetaShapedTexture.offscreen");
paint_context =
clutter_paint_context_new_for_framebuffer (fb, CLUTTER_PAINT_FLAG_NONE);
clutter_paint_context_new_for_framebuffer (fb, NULL,
CLUTTER_PAINT_FLAG_NONE);
do_paint_content (stex, root_node, paint_context,
stex->texture,

View File

@ -1322,7 +1322,7 @@ meta_window_actor_blit_to_framebuffer (MetaScreenCastWindow *screen_cast_window,
cogl_framebuffer_translate (framebuffer, -x, -y, 0);
paint_context =
clutter_paint_context_new_for_framebuffer (framebuffer,
clutter_paint_context_new_for_framebuffer (framebuffer, NULL,
CLUTTER_PAINT_FLAG_NONE);
clutter_actor_paint (actor, paint_context);
clutter_paint_context_destroy (paint_context);
@ -1482,7 +1482,7 @@ meta_window_actor_get_image (MetaWindowActor *self,
cogl_framebuffer_translate (framebuffer, -x, -y, 0);
paint_context =
clutter_paint_context_new_for_framebuffer (framebuffer,
clutter_paint_context_new_for_framebuffer (framebuffer, NULL,
CLUTTER_PAINT_FLAG_NONE);
clutter_actor_paint (actor, paint_context);
clutter_paint_context_destroy (paint_context);