[mutter/gnome-3-36] clutter/paint-context: Add paint flag



commit 858c12e73fbc83e083167959a873e39a1f509f40
Author: Jonas Ådahl <jadahl gmail com>
Date:   Mon Apr 20 21:10:23 2020 +0200

    clutter/paint-context: Add paint flag
    
    A paint flag affects a paint operation in ways defined by the flags.
    Currently no flags are defined, so no semantical changes are defined
    yet. Eventually a flag aiming to avoid painting of cursors is going to
    be added, so that screen cast streams can decide whether to include a
    cursor or not.
    
    Changes for gnome-3-36: Removed flag from offscreen context.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1222

 clutter/clutter/clutter-paint-context-private.h | 11 ++++++++++-
 clutter/clutter/clutter-paint-context.c         | 16 +++++++++++++++-
 clutter/clutter/clutter-stage.c                 |  3 ++-
 3 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/clutter/clutter/clutter-paint-context-private.h b/clutter/clutter/clutter-paint-context-private.h
index a825c8ffd..32c54c0ab 100644
--- a/clutter/clutter/clutter-paint-context-private.h
+++ b/clutter/clutter/clutter-paint-context-private.h
@@ -20,11 +20,20 @@
 
 #include "clutter-paint-context.h"
 
+typedef enum _ClutterPaintFlag
+{
+  CLUTTER_PAINT_FLAG_NONE = 0,
+} ClutterPaintFlag;
+
 ClutterPaintContext * clutter_paint_context_new_for_view (ClutterStageView     *view,
-                                                          const cairo_region_t *redraw_clip);
+                                                          const cairo_region_t *redraw_clip,
+                                                          ClutterPaintFlag      paint_flags);
 
 gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
 
 CoglFramebuffer * clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context);
 
+CLUTTER_EXPORT
+ClutterPaintFlag clutter_paint_context_get_paint_flags (ClutterPaintContext *paint_context);
+
 #endif /* CLUTTER_PAINT_CONTEXT_PRIVATE_H */
diff --git a/clutter/clutter/clutter-paint-context.c b/clutter/clutter/clutter-paint-context.c
index d0d334951..d331f97bb 100644
--- a/clutter/clutter/clutter-paint-context.c
+++ b/clutter/clutter/clutter-paint-context.c
@@ -23,6 +23,8 @@ struct _ClutterPaintContext
 {
   grefcount ref_count;
 
+  ClutterPaintFlag paint_flags;
+
   GList *framebuffers;
 
   ClutterStageView *view;
@@ -36,7 +38,8 @@ G_DEFINE_BOXED_TYPE (ClutterPaintContext, clutter_paint_context,
 
 ClutterPaintContext *
 clutter_paint_context_new_for_view (ClutterStageView     *view,
-                                    const cairo_region_t *redraw_clip)
+                                    const cairo_region_t *redraw_clip,
+                                    ClutterPaintFlag      paint_flags)
 {
   ClutterPaintContext *paint_context;
   CoglFramebuffer *framebuffer;
@@ -45,6 +48,7 @@ clutter_paint_context_new_for_view (ClutterStageView     *view,
   g_ref_count_init (&paint_context->ref_count);
   paint_context->view = view;
   paint_context->redraw_clip = cairo_region_copy (redraw_clip);
+  paint_context->paint_flags = paint_flags;
 
   framebuffer = clutter_stage_view_get_framebuffer (view);
   clutter_paint_context_push_framebuffer (paint_context, framebuffer);
@@ -62,6 +66,7 @@ clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer)
 
   paint_context = g_new0 (ClutterPaintContext, 1);
   g_ref_count_init (&paint_context->ref_count);
+  paint_context->paint_flags = CLUTTER_PAINT_FLAG_NONE;
 
   clutter_paint_context_push_framebuffer (paint_context, framebuffer);
 
@@ -170,3 +175,12 @@ clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context)
 
   return !paint_context->view;
 }
+
+/**
+ * clutter_paint_context_get_paint_flags: (skip)
+ */
+ClutterPaintFlag
+clutter_paint_context_get_paint_flags (ClutterPaintContext *paint_context)
+{
+  return paint_context->paint_flags;
+}
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index 458778658..a123eae73 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -934,7 +934,8 @@ clutter_stage_do_paint_view (ClutterStage         *stage,
   ClutterPaintContext *paint_context;
   cairo_rectangle_int_t clip_rect;
 
-  paint_context = clutter_paint_context_new_for_view (view, redraw_clip);
+  paint_context = clutter_paint_context_new_for_view (view, redraw_clip,
+                                                      CLUTTER_PAINT_FLAG_NONE);
 
   cairo_region_get_extents (redraw_clip, &clip_rect);
   setup_view_for_pick_or_paint (stage, view, &clip_rect);


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