clutter/stage-view: Move framebuffer sanity check into helper
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
This commit is contained in:
parent
5e7ce7ea75
commit
1e284c601c
@ -991,6 +991,22 @@ clutter_stage_view_take_scanout (ClutterStageView *view)
|
||||
return g_steal_pointer (&priv->next_scanout);
|
||||
}
|
||||
|
||||
static void
|
||||
sanity_check_framebuffer (ClutterStageView *view)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
G_GNUC_UNUSED int fb_width, fb_height;
|
||||
|
||||
fb_width = cogl_framebuffer_get_width (priv->framebuffer);
|
||||
fb_height = cogl_framebuffer_get_height (priv->framebuffer);
|
||||
|
||||
g_warn_if_fail (fabsf (roundf (fb_width / priv->scale) -
|
||||
fb_width / priv->scale) < FLT_EPSILON);
|
||||
g_warn_if_fail (fabsf (roundf (fb_height / priv->scale) -
|
||||
fb_height / priv->scale) < FLT_EPSILON);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_view_set_framebuffer (ClutterStageView *view,
|
||||
CoglFramebuffer *framebuffer)
|
||||
@ -1000,20 +1016,8 @@ clutter_stage_view_set_framebuffer (ClutterStageView *view,
|
||||
|
||||
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_height = cogl_framebuffer_get_height (priv->framebuffer);
|
||||
|
||||
g_warn_if_fail (fabsf (roundf (fb_width / priv->scale) -
|
||||
fb_width / priv->scale) < FLT_EPSILON);
|
||||
g_warn_if_fail (fabsf (roundf (fb_height / priv->scale) -
|
||||
fb_height / priv->scale) < FLT_EPSILON);
|
||||
}
|
||||
#endif
|
||||
sanity_check_framebuffer (view);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user