[mutter] surface-actor-wayland: Optimize get_current_primary_view for single view
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] surface-actor-wayland: Optimize get_current_primary_view for single view
- Date: Mon, 23 Nov 2020 14:05:30 +0000 (UTC)
commit 3b7137cb3595ebf78491966f6ee1037ba9e9b6e1
Author: Robert Mader <robert mader posteo de>
Date: Mon Nov 23 01:32:32 2020 +0100
surface-actor-wayland: Optimize get_current_primary_view for single view
In case we only have a single view (or there's only one view left to
check and the actor is visible on previous views) we can take a short-
cut, saving a region allocation and some calculations.
While on it, declare float numbers in '.f' style to make them more
recognizable.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1596>
src/compositor/meta-surface-actor-wayland.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/src/compositor/meta-surface-actor-wayland.c b/src/compositor/meta-surface-actor-wayland.c
index 08b4f79f76..eba68fe496 100644
--- a/src/compositor/meta-surface-actor-wayland.c
+++ b/src/compositor/meta-surface-actor-wayland.c
@@ -88,15 +88,15 @@ meta_surface_actor_wayland_get_current_primary_view (MetaSurfaceActor *actor,
ClutterStage *stage)
{
ClutterStageView *current_primary_view = NULL;
- float highest_refresh_rate = 0;
- float biggest_unobscurred_fraction = 0;
+ float highest_refresh_rate = 0.f;
+ float biggest_unobscurred_fraction = 0.f;
GList *l;
for (l = clutter_stage_peek_stage_views (stage); l; l = l->next)
{
ClutterStageView *stage_view = l->data;
float refresh_rate;
- float unobscurred_fraction = 1.0;
+ float unobscurred_fraction = 1.f;
if (clutter_actor_has_mapped_clones (CLUTTER_ACTOR (actor)))
{
@@ -106,10 +106,18 @@ meta_surface_actor_wayland_get_current_primary_view (MetaSurfaceActor *actor,
}
else
{
- if (meta_surface_actor_is_obscured_on_stage_view (actor,
- stage_view,
- &unobscurred_fraction))
- continue;
+ if (l->next || biggest_unobscurred_fraction > 0.f)
+ {
+ if (meta_surface_actor_is_obscured_on_stage_view (actor,
+ stage_view,
+ &unobscurred_fraction))
+ continue;
+ }
+ else
+ {
+ if (meta_surface_actor_is_obscured (actor))
+ continue;
+ }
}
refresh_rate = clutter_stage_view_get_refresh_rate (stage_view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]