[mutter/gbsneto/more-screencast: 6/10] monitor-stream-src: Blit scanout when available




commit 246cbbb660e4a0ef13d772133cf041683ad66133
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Aug 28 23:01:11 2020 -0300

    monitor-stream-src: Blit scanout when available
    
    When there's a direct scanout set in the stage view, we
    have to use it instead of the view's regular onscreen
    framebuffer.
    
    Use the new CoglScanout API to implement blitting to the
    stream framebuffer.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421

 src/backends/meta-screen-cast-monitor-stream-src.c | 32 +++++++++++++++-------
 1 file changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/src/backends/meta-screen-cast-monitor-stream-src.c 
b/src/backends/meta-screen-cast-monitor-stream-src.c
index 78aba0a953..8ca0d4e248 100644
--- a/src/backends/meta-screen-cast-monitor-stream-src.c
+++ b/src/backends/meta-screen-cast-monitor-stream-src.c
@@ -520,6 +520,7 @@ meta_screen_cast_monitor_stream_src_record_to_framebuffer (MetaScreenCastStreamS
     {
       ClutterStageView *view = CLUTTER_STAGE_VIEW (l->data);
       CoglFramebuffer *view_framebuffer;
+      CoglScanout *scanout;
       MetaRectangle view_layout;
       int x, y;
 
@@ -528,19 +529,30 @@ meta_screen_cast_monitor_stream_src_record_to_framebuffer (MetaScreenCastStreamS
       if (!meta_rectangle_overlap (&logical_monitor_layout, &view_layout))
         continue;
 
-      view_framebuffer = clutter_stage_view_get_framebuffer (view);
-
       x = (int) roundf ((view_layout.x - logical_monitor_layout.x) * view_scale);
       y = (int) roundf ((view_layout.y - logical_monitor_layout.y) * view_scale);
 
-      if (!cogl_blit_framebuffer (view_framebuffer,
-                                  framebuffer,
-                                  0, 0,
-                                  x, y,
-                                  cogl_framebuffer_get_width (view_framebuffer),
-                                  cogl_framebuffer_get_height (view_framebuffer),
-                                  error))
-        return FALSE;
+      scanout = clutter_stage_view_peek_scanout (view);
+      if (scanout)
+        {
+          if (!cogl_scanout_blit_to_framebuffer (scanout,
+                                                 framebuffer,
+                                                 x, y,
+                                                 error))
+              return FALSE;
+        }
+      else
+        {
+          view_framebuffer = clutter_stage_view_get_framebuffer (view);
+          if (!cogl_blit_framebuffer (view_framebuffer,
+                                      framebuffer,
+                                      0, 0,
+                                      x, y,
+                                      cogl_framebuffer_get_width (view_framebuffer),
+                                      cogl_framebuffer_get_height (view_framebuffer),
+                                      error))
+            return FALSE;
+        }
     }
 
   cogl_framebuffer_finish (framebuffer);


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