mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
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>
This commit is contained in:
parent
27131198c7
commit
3b7137cb35
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user