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
This commit is contained in:
Georges Basile Stavracas Neto 2020-08-28 23:01:11 -03:00
parent 098360f2c2
commit b1648e75a8

View File

@ -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,11 +529,21 @@ 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);
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,
@ -542,6 +553,7 @@ meta_screen_cast_monitor_stream_src_record_to_framebuffer (MetaScreenCastStreamS
error))
return FALSE;
}
}
cogl_framebuffer_finish (framebuffer);