mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
clutter/stage: Remove _clutter_stage_get_max_view_scale_factor_for_rect
Since we now have _clutter_stage_get_views_for_rect(), we can easily replace _clutter_stage_get_max_view_scale_factor_for_rect() with it and remove that private method. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1196
This commit is contained in:
parent
e27d2702a8
commit
670f4f22fe
@ -17421,17 +17421,27 @@ _clutter_actor_get_resource_scale_for_rect (ClutterActor *self,
|
||||
float *resource_scale)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
g_autoptr (GList) views = NULL;
|
||||
GList *l;
|
||||
float max_scale = 0;
|
||||
|
||||
stage = _clutter_actor_get_stage_internal (self);
|
||||
if (!stage)
|
||||
return FALSE;
|
||||
|
||||
if (!_clutter_stage_get_max_view_scale_factor_for_rect (CLUTTER_STAGE (stage),
|
||||
bounding_rect,
|
||||
&max_scale))
|
||||
views = clutter_stage_get_views_for_rect (CLUTTER_STAGE (stage),
|
||||
bounding_rect);
|
||||
|
||||
if (!views)
|
||||
return FALSE;
|
||||
|
||||
for (l = views; l; l = l->next)
|
||||
{
|
||||
ClutterStageView *view = l->data;
|
||||
|
||||
max_scale = MAX (clutter_stage_view_get_scale (view), max_scale);
|
||||
}
|
||||
|
||||
*resource_scale = max_scale;
|
||||
|
||||
return TRUE;
|
||||
|
@ -125,9 +125,6 @@ gboolean _clutter_stage_update_state (ClutterStage *stag
|
||||
|
||||
void _clutter_stage_set_scale_factor (ClutterStage *stage,
|
||||
int factor);
|
||||
gboolean _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
|
||||
graphene_rect_t *rect,
|
||||
float *view_scale);
|
||||
|
||||
void _clutter_stage_presented (ClutterStage *stage,
|
||||
CoglFrameEvent frame_event,
|
||||
|
@ -4077,20 +4077,29 @@ clutter_stage_get_capture_final_size (ClutterStage *stage,
|
||||
int *out_height,
|
||||
float *out_scale)
|
||||
{
|
||||
float max_scale;
|
||||
float max_scale = 1.0;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
||||
|
||||
if (rect)
|
||||
{
|
||||
graphene_rect_t capture_rect;
|
||||
g_autoptr (GList) views = NULL;
|
||||
GList *l;
|
||||
|
||||
_clutter_util_rect_from_rectangle (rect, &capture_rect);
|
||||
if (!_clutter_stage_get_max_view_scale_factor_for_rect (stage,
|
||||
&capture_rect,
|
||||
&max_scale))
|
||||
views = clutter_stage_get_views_for_rect (stage, &capture_rect);
|
||||
|
||||
if (!views)
|
||||
return FALSE;
|
||||
|
||||
for (l = views; l; l = l->next)
|
||||
{
|
||||
ClutterStageView *view = l->data;
|
||||
|
||||
max_scale = MAX (clutter_stage_view_get_scale (view), max_scale);
|
||||
}
|
||||
|
||||
if (out_width)
|
||||
*out_width = (gint) roundf (rect->width * max_scale);
|
||||
|
||||
@ -4376,35 +4385,6 @@ clutter_stage_update_resource_scales (ClutterStage *stage)
|
||||
_clutter_actor_queue_update_resource_scale_recursive (CLUTTER_ACTOR (stage));
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
|
||||
graphene_rect_t *rect,
|
||||
float *view_scale)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
float scale = 0.0f;
|
||||
GList *l;
|
||||
|
||||
for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
|
||||
{
|
||||
ClutterStageView *view = l->data;
|
||||
cairo_rectangle_int_t view_layout;
|
||||
graphene_rect_t view_rect;
|
||||
|
||||
clutter_stage_view_get_layout (view, &view_layout);
|
||||
_clutter_util_rect_from_rectangle (&view_layout, &view_rect);
|
||||
|
||||
if (graphene_rect_intersection (&view_rect, rect, NULL))
|
||||
scale = MAX (clutter_stage_view_get_scale (view), scale);
|
||||
}
|
||||
|
||||
if (scale == 0.0)
|
||||
return FALSE;
|
||||
|
||||
*view_scale = scale;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GList *
|
||||
clutter_stage_get_views_for_rect (ClutterStage *stage,
|
||||
const graphene_rect_t *rect)
|
||||
|
Loading…
Reference in New Issue
Block a user