clutter/stage-view: Move shadowfb struct fields into anonymous struct

With the aim to collect shadow buffer related things in one place, place
them in an anonymous struct.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
This commit is contained in:
Jonas Ådahl 2020-04-30 18:19:30 +02:00 committed by Georges Basile Stavracas Neto
parent f4d9953b9c
commit 675a2d13b9

View File

@ -55,8 +55,10 @@ typedef struct _ClutterStageViewPrivate
CoglPipeline *offscreen_pipeline; CoglPipeline *offscreen_pipeline;
gboolean use_shadowfb; gboolean use_shadowfb;
CoglOffscreen *shadowfb; struct {
CoglPipeline *shadowfb_pipeline; CoglOffscreen *framebuffer;
CoglPipeline *pipeline;
} shadow;
CoglScanout *next_scanout; CoglScanout *next_scanout;
@ -95,8 +97,8 @@ clutter_stage_view_get_framebuffer (ClutterStageView *view)
if (priv->offscreen) if (priv->offscreen)
return priv->offscreen; return priv->offscreen;
else if (priv->shadowfb) else if (priv->shadow.framebuffer)
return priv->shadowfb; return priv->shadow.framebuffer;
else else
return priv->framebuffer; return priv->framebuffer;
} }
@ -162,11 +164,11 @@ clutter_stage_view_ensure_shadowfb_blit_pipeline (ClutterStageView *view)
ClutterStageViewPrivate *priv = ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view); clutter_stage_view_get_instance_private (view);
if (priv->shadowfb_pipeline) if (priv->shadow.pipeline)
return; return;
priv->shadowfb_pipeline = priv->shadow.pipeline =
clutter_stage_view_create_framebuffer_pipeline (priv->shadowfb); clutter_stage_view_create_framebuffer_pipeline (priv->shadow.framebuffer);
} }
void void
@ -260,7 +262,7 @@ init_offscreen_shadowfb (ClutterStageView *view,
if (!offscreen) if (!offscreen)
return FALSE; return FALSE;
priv->shadowfb = offscreen; priv->shadow.framebuffer = offscreen;
return TRUE; return TRUE;
} }
@ -304,12 +306,12 @@ clutter_stage_view_after_paint (ClutterStageView *view)
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix); clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
can_blit = cogl_matrix_is_identity (&matrix); can_blit = cogl_matrix_is_identity (&matrix);
if (priv->shadowfb) if (priv->shadow.framebuffer)
{ {
clutter_stage_view_copy_to_framebuffer (view, clutter_stage_view_copy_to_framebuffer (view,
priv->offscreen_pipeline, priv->offscreen_pipeline,
priv->offscreen, priv->offscreen,
priv->shadowfb, priv->shadow.framebuffer,
can_blit); can_blit);
} }
else else
@ -322,12 +324,12 @@ clutter_stage_view_after_paint (ClutterStageView *view)
} }
} }
if (priv->shadowfb) if (priv->shadow.framebuffer)
{ {
clutter_stage_view_ensure_shadowfb_blit_pipeline (view); clutter_stage_view_ensure_shadowfb_blit_pipeline (view);
clutter_stage_view_copy_to_framebuffer (view, clutter_stage_view_copy_to_framebuffer (view,
priv->shadowfb_pipeline, priv->shadow.pipeline,
priv->shadowfb, priv->shadow.framebuffer,
priv->framebuffer, priv->framebuffer,
TRUE); TRUE);
} }
@ -616,10 +618,10 @@ clutter_stage_view_dispose (GObject *object)
g_clear_pointer (&priv->name, g_free); g_clear_pointer (&priv->name, g_free);
g_clear_pointer (&priv->framebuffer, cogl_object_unref); g_clear_pointer (&priv->framebuffer, cogl_object_unref);
g_clear_pointer (&priv->shadowfb, cogl_object_unref); g_clear_pointer (&priv->shadow.framebuffer, cogl_object_unref);
g_clear_pointer (&priv->shadow.pipeline, cogl_object_unref);
g_clear_pointer (&priv->offscreen, cogl_object_unref); g_clear_pointer (&priv->offscreen, cogl_object_unref);
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref); g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
g_clear_pointer (&priv->shadowfb_pipeline, cogl_object_unref);
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy); g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object); G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);