mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 19:12:04 +00:00
clutter/stage-view: Move fb viewport and projection setting to here
The stage would fetch the front framebuffer and set the viewport and projection matrix, but if we are going to more than one front buffer, that won't work, so let the stage just pass the viewport and projection matrix to the view and have the view deal with the framebuffer(s). https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
This commit is contained in:
parent
675a2d13b9
commit
c4949b553d
@ -27,11 +27,20 @@ gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
||||
void clutter_stage_view_set_dirty_viewport (ClutterStageView *view,
|
||||
gboolean dirty);
|
||||
|
||||
void clutter_stage_view_set_viewport (ClutterStageView *view,
|
||||
float x,
|
||||
float y,
|
||||
float width,
|
||||
float height);
|
||||
|
||||
gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
|
||||
|
||||
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
|
||||
gboolean dirty);
|
||||
|
||||
void clutter_stage_view_set_projection (ClutterStageView *view,
|
||||
const CoglMatrix *matrix);
|
||||
|
||||
void clutter_stage_view_add_redraw_clip (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip);
|
||||
|
||||
|
@ -363,6 +363,22 @@ clutter_stage_view_set_dirty_viewport (ClutterStageView *view,
|
||||
priv->dirty_viewport = dirty;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_view_set_viewport (ClutterStageView *view,
|
||||
float x,
|
||||
float y,
|
||||
float width,
|
||||
float height)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
priv->dirty_viewport = FALSE;
|
||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
cogl_framebuffer_set_viewport (framebuffer, x, y, width, height);
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_stage_view_is_dirty_projection (ClutterStageView *view)
|
||||
{
|
||||
@ -382,6 +398,19 @@ clutter_stage_view_set_dirty_projection (ClutterStageView *view,
|
||||
priv->dirty_projection = dirty;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_view_set_projection (ClutterStageView *view,
|
||||
const CoglMatrix *matrix)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
priv->dirty_projection = FALSE;
|
||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
cogl_framebuffer_set_projection_matrix (framebuffer, matrix);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
|
||||
CoglMatrix *matrix)
|
||||
|
@ -3147,7 +3147,6 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
|
||||
ClutterStageView *view)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
|
||||
|
||||
if (clutter_stage_view_is_dirty_viewport (view))
|
||||
{
|
||||
@ -3174,19 +3173,14 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
|
||||
viewport_y = roundf (priv->viewport[1] * fb_scale - viewport_offset_y);
|
||||
viewport_width = roundf (priv->viewport[2] * fb_scale);
|
||||
viewport_height = roundf (priv->viewport[3] * fb_scale);
|
||||
cogl_framebuffer_set_viewport (fb,
|
||||
viewport_x, viewport_y,
|
||||
viewport_width, viewport_height);
|
||||
|
||||
clutter_stage_view_set_dirty_viewport (view, FALSE);
|
||||
clutter_stage_view_set_viewport (view,
|
||||
viewport_x, viewport_y,
|
||||
viewport_width, viewport_height);
|
||||
}
|
||||
|
||||
if (clutter_stage_view_is_dirty_projection (view))
|
||||
{
|
||||
cogl_framebuffer_set_projection_matrix (fb, &priv->projection);
|
||||
|
||||
clutter_stage_view_set_dirty_projection (view, FALSE);
|
||||
}
|
||||
clutter_stage_view_set_projection (view, &priv->projection);
|
||||
}
|
||||
|
||||
#undef _DEG_TO_RAD
|
||||
|
Loading…
Reference in New Issue
Block a user