[mutter] clutter/stage: Remove _clutter_stage_get_max_view_scale_factor_for_rect
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/stage: Remove _clutter_stage_get_max_view_scale_factor_for_rect
- Date: Tue, 9 Jun 2020 16:45:33 +0000 (UTC)
commit 670f4f22fea2de5650bc67ad6f17b99b78185be0
Author: Jonas Dreßler <verdre v0yd nl>
Date: Fri Apr 10 00:53:33 2020 +0200
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
clutter/clutter/clutter-actor.c | 16 +++++++++---
clutter/clutter/clutter-stage-private.h | 3 ---
clutter/clutter/clutter-stage.c | 46 ++++++++++-----------------------
3 files changed, 26 insertions(+), 39 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index df6b14338f..4d79e88bac 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -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;
diff --git a/clutter/clutter/clutter-stage-private.h b/clutter/clutter/clutter-stage-private.h
index ba4a77b733..5d785b644a 100644
--- a/clutter/clutter/clutter-stage-private.h
+++ b/clutter/clutter/clutter-stage-private.h
@@ -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,
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index fed84e9b00..1c5f5685af 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]