clutter/stage: Make set_viewport() a static method

Since clutter_stage_set_viewport() is only used inside clutter-stage.c
anyway, we can make it a static method. Also we can remove the x and y
arguments from it since they're always set to 0 anyway.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1247
This commit is contained in:
Jonas Dreßler 2020-06-02 15:25:34 +02:00 committed by Jonas Ådahl
parent 7abf0f1e2d
commit 38104755a2
2 changed files with 12 additions and 21 deletions

View File

@ -50,11 +50,6 @@ ClutterStageWindow *_clutter_stage_get_window (ClutterStage
void _clutter_stage_get_projection_matrix (ClutterStage *stage, void _clutter_stage_get_projection_matrix (ClutterStage *stage,
CoglMatrix *projection); CoglMatrix *projection);
void _clutter_stage_dirty_projection (ClutterStage *stage); void _clutter_stage_dirty_projection (ClutterStage *stage);
void _clutter_stage_set_viewport (ClutterStage *stage,
float x,
float y,
float width,
float height);
void _clutter_stage_get_viewport (ClutterStage *stage, void _clutter_stage_get_viewport (ClutterStage *stage,
float *x, float *x,
float *y, float *y,

View File

@ -189,6 +189,9 @@ static void capture_view_into (ClutterStage *stage,
uint8_t *data, uint8_t *data,
int stride); int stride);
static void clutter_stage_update_view_perspective (ClutterStage *stage); static void clutter_stage_update_view_perspective (ClutterStage *stage);
static void clutter_stage_set_viewport (ClutterStage *stage,
float width,
float height);
static void clutter_container_iface_init (ClutterContainerIface *iface); static void clutter_container_iface_init (ClutterContainerIface *iface);
@ -718,10 +721,7 @@ clutter_stage_allocate (ClutterActor *self,
clutter_actor_get_allocation_box (self, &alloc); clutter_actor_get_allocation_box (self, &alloc);
clutter_actor_box_get_size (&alloc, &new_width, &new_height); clutter_actor_box_get_size (&alloc, &new_width, &new_height);
_clutter_stage_set_viewport (CLUTTER_STAGE (self), clutter_stage_set_viewport (CLUTTER_STAGE (self), new_width, new_height);
0, 0,
new_width,
new_height);
} }
typedef struct _Vector4 typedef struct _Vector4
@ -2239,10 +2239,7 @@ clutter_stage_init (ClutterStage *self)
g_signal_connect (self, "notify::min-height", g_signal_connect (self, "notify::min-height",
G_CALLBACK (clutter_stage_notify_min_size), NULL); G_CALLBACK (clutter_stage_notify_min_size), NULL);
_clutter_stage_set_viewport (self, clutter_stage_set_viewport (self, geom.width, geom.height);
0, 0,
geom.width,
geom.height);
priv->paint_volume_stack = priv->paint_volume_stack =
g_array_new (FALSE, FALSE, sizeof (ClutterPaintVolume)); g_array_new (FALSE, FALSE, sizeof (ClutterPaintVolume));
@ -2429,8 +2426,6 @@ _clutter_stage_dirty_projection (ClutterStage *stage)
/* /*
* clutter_stage_set_viewport: * clutter_stage_set_viewport:
* @stage: A #ClutterStage * @stage: A #ClutterStage
* @x: The X postition to render the stage at, in window coordinates
* @y: The Y position to render the stage at, in window coordinates
* @width: The width to render the stage at, in window coordinates * @width: The width to render the stage at, in window coordinates
* @height: The height to render the stage at, in window coordinates * @height: The height to render the stage at, in window coordinates
* *
@ -2463,19 +2458,20 @@ _clutter_stage_dirty_projection (ClutterStage *stage)
* *
* Since: 1.6 * Since: 1.6
*/ */
void static void
_clutter_stage_set_viewport (ClutterStage *stage, clutter_stage_set_viewport (ClutterStage *stage,
float x, float width,
float y, float height)
float width,
float height)
{ {
ClutterStagePrivate *priv; ClutterStagePrivate *priv;
float x, y;
g_return_if_fail (CLUTTER_IS_STAGE (stage)); g_return_if_fail (CLUTTER_IS_STAGE (stage));
priv = stage->priv; priv = stage->priv;
x = 0.f;
y = 0.f;
width = roundf (width); width = roundf (width);
height = roundf (height); height = roundf (height);