diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index d0f7434ef..fd38338c7 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -17785,29 +17785,15 @@ _clutter_actor_get_resource_scale_for_rect (ClutterActor *self, float *resource_scale) { ClutterActor *stage; - GList *views; - GList *l; float max_scale = 0; stage = _clutter_actor_get_stage_internal (self); if (!stage) return FALSE; - views = _clutter_stage_peek_stage_views (CLUTTER_STAGE (stage)); - for (l = views; l; l = l->next) - { - ClutterStageView *view = l->data; - cairo_rectangle_int_t view_layout; - ClutterRect view_rect; - - clutter_stage_view_get_layout (view, &view_layout); - _clutter_util_rect_from_rectangle (&view_layout, &view_rect); - - if (clutter_rect_intersection (&view_rect, bounding_rect, NULL)) - max_scale = MAX (clutter_stage_view_get_scale (view), max_scale); - } - - if (max_scale == 0) + if (!_clutter_stage_get_max_view_scale_factor_for_rect (CLUTTER_STAGE (stage), + bounding_rect, + &max_scale)) return FALSE; *resource_scale = max_scale; diff --git a/clutter/clutter/clutter-stage-private.h b/clutter/clutter/clutter-stage-private.h index 688768bac..4799c29e1 100644 --- a/clutter/clutter/clutter-stage-private.h +++ b/clutter/clutter/clutter-stage-private.h @@ -124,6 +124,9 @@ 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, + ClutterRect *rect, + float *view_scale); void _clutter_stage_presented (ClutterStage *stage, CoglFrameEvent frame_event, diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index d284692c0..7ed83184a 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -5018,3 +5018,32 @@ 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, + ClutterRect *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; + ClutterRect view_rect; + + clutter_stage_view_get_layout (view, &view_layout); + _clutter_util_rect_from_rectangle (&view_layout, &view_rect); + + if (clutter_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; +}