clutter/stage-view: Move framebuffer sanity check into helper

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
This commit is contained in:
Jonas Ådahl 2020-04-09 10:49:07 +02:00
parent 5e7ce7ea75
commit 1e284c601c

View File

@ -992,18 +992,11 @@ clutter_stage_view_take_scanout (ClutterStageView *view)
} }
static void static void
clutter_stage_view_set_framebuffer (ClutterStageView *view, sanity_check_framebuffer (ClutterStageView *view)
CoglFramebuffer *framebuffer)
{ {
ClutterStageViewPrivate *priv = ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view); clutter_stage_view_get_instance_private (view);
G_GNUC_UNUSED int fb_width, fb_height;
priv->framebuffer = cogl_object_ref (framebuffer);
#ifndef G_DISABLE_CHECKS
if (priv->framebuffer)
{
int fb_width, fb_height;
fb_width = cogl_framebuffer_get_width (priv->framebuffer); fb_width = cogl_framebuffer_get_width (priv->framebuffer);
fb_height = cogl_framebuffer_get_height (priv->framebuffer); fb_height = cogl_framebuffer_get_height (priv->framebuffer);
@ -1013,7 +1006,18 @@ clutter_stage_view_set_framebuffer (ClutterStageView *view,
g_warn_if_fail (fabsf (roundf (fb_height / priv->scale) - g_warn_if_fail (fabsf (roundf (fb_height / priv->scale) -
fb_height / priv->scale) < FLT_EPSILON); fb_height / priv->scale) < FLT_EPSILON);
} }
#endif
static void
clutter_stage_view_set_framebuffer (ClutterStageView *view,
CoglFramebuffer *framebuffer)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
priv->framebuffer = cogl_object_ref (framebuffer);
if (priv->framebuffer)
sanity_check_framebuffer (view);
} }
static void static void