mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
clutter/stage-view: Only blit the damage part of the shadow buffer
This fixes the last "copy everything" paths when clutter doesn't directly paint onto the onscreen framebuffer. It adds a new hook into the stage view called before the swap buffer, as at this point, we have the swap buffer damag regions ready, which corresponds to the regions we must blit according to the damage reported to clutter. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
This commit is contained in:
parent
9e34028742
commit
8798325489
@ -23,6 +23,9 @@
|
|||||||
void clutter_stage_view_after_paint (ClutterStageView *view,
|
void clutter_stage_view_after_paint (ClutterStageView *view,
|
||||||
cairo_region_t *redraw_clip);
|
cairo_region_t *redraw_clip);
|
||||||
|
|
||||||
|
void clutter_stage_view_before_swap_buffer (ClutterStageView *view,
|
||||||
|
const cairo_region_t *swap_region);
|
||||||
|
|
||||||
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
||||||
|
|
||||||
void clutter_stage_view_invalidate_viewport (ClutterStageView *view);
|
void clutter_stage_view_invalidate_viewport (ClutterStageView *view);
|
||||||
|
@ -370,11 +370,22 @@ clutter_stage_view_after_paint (ClutterStageView *view,
|
|||||||
redraw_clip);
|
redraw_clip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (priv->shadow.framebuffer)
|
void
|
||||||
|
clutter_stage_view_before_swap_buffer (ClutterStageView *view,
|
||||||
|
const cairo_region_t *swap_region)
|
||||||
|
{
|
||||||
|
ClutterStageViewPrivate *priv =
|
||||||
|
clutter_stage_view_get_instance_private (view);
|
||||||
|
g_autoptr (GError) error = NULL;
|
||||||
|
|
||||||
|
if (!priv->shadow.framebuffer)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (cairo_region_is_empty (swap_region))
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
g_autoptr (GError) error = NULL;
|
|
||||||
|
|
||||||
width = cogl_framebuffer_get_width (priv->framebuffer);
|
width = cogl_framebuffer_get_width (priv->framebuffer);
|
||||||
height = cogl_framebuffer_get_height (priv->framebuffer);
|
height = cogl_framebuffer_get_height (priv->framebuffer);
|
||||||
@ -384,12 +395,32 @@ clutter_stage_view_after_paint (ClutterStageView *view,
|
|||||||
0, 0,
|
0, 0,
|
||||||
width, height,
|
width, height,
|
||||||
&error))
|
&error))
|
||||||
|
g_warning ("Failed to blit shadow buffer: %s", error->message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int n_rects;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
n_rects = cairo_region_num_rectangles (swap_region);
|
||||||
|
for (i = 0; i < n_rects; i++)
|
||||||
|
{
|
||||||
|
cairo_rectangle_int_t rect;
|
||||||
|
|
||||||
|
cairo_region_get_rectangle (swap_region, i, &rect);
|
||||||
|
if (!cogl_blit_framebuffer (priv->shadow.framebuffer,
|
||||||
|
priv->framebuffer,
|
||||||
|
rect.x, rect.y,
|
||||||
|
rect.x, rect.y,
|
||||||
|
rect.width, rect.height,
|
||||||
|
&error))
|
||||||
{
|
{
|
||||||
g_warning ("Failed to blit shadow buffer: %s", error->message);
|
g_warning ("Failed to blit shadow buffer: %s", error->message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
clutter_stage_view_get_scale (ClutterStageView *view)
|
clutter_stage_view_get_scale (ClutterStageView *view)
|
||||||
|
@ -379,6 +379,8 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
|||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
|
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
|
||||||
|
|
||||||
|
clutter_stage_view_before_swap_buffer (view, swap_region);
|
||||||
|
|
||||||
if (cogl_is_onscreen (framebuffer))
|
if (cogl_is_onscreen (framebuffer))
|
||||||
{
|
{
|
||||||
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
|
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user