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



commit a4f55d498684e7381c75dc2052dd587fa94ac35e
Author: Jonas Ådahl <jadahl gmail com>
Date:   Mon Apr 20 21:13:38 2020 +0200

    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

 clutter/clutter/clutter-paint-context.c | 6 ++++--
 clutter/clutter/clutter-paint-context.h | 5 +++--
 src/compositor/meta-shaped-texture.c    | 3 ++-
 src/compositor/meta-window-actor.c      | 4 ++--
 4 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/clutter/clutter/clutter-paint-context.c b/clutter/clutter/clutter-paint-context.c
index 4d5639e88..598183506 100644
--- a/clutter/clutter/clutter-paint-context.c
+++ b/clutter/clutter/clutter-paint-context.c
@@ -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);
diff --git a/clutter/clutter/clutter-paint-context.h b/clutter/clutter/clutter-paint-context.h
index 6b0bb0859..6b65fecac 100644
--- a/clutter/clutter/clutter-paint-context.h
+++ b/clutter/clutter/clutter-paint-context.h
@@ -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);
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index e0c31e866..8e86693fc 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -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,
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index cd47e5244..79f4ce6a6 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]