mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
monitor: Replace some useless goto with clearer returns
There was no point to use goto in place of normal returns here. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1878>
This commit is contained in:
parent
b088dbd90b
commit
f6e2059a65
@ -1672,7 +1672,7 @@ calculate_scale (MetaMonitor *monitor,
|
|||||||
&resolution_height);
|
&resolution_height);
|
||||||
|
|
||||||
if (resolution_height < HIDPI_MIN_HEIGHT)
|
if (resolution_height < HIDPI_MIN_HEIGHT)
|
||||||
goto out;
|
return scale;
|
||||||
|
|
||||||
/* 4K TV */
|
/* 4K TV */
|
||||||
switch (meta_monitor_get_connector_type (monitor))
|
switch (meta_monitor_get_connector_type (monitor))
|
||||||
@ -1680,7 +1680,7 @@ calculate_scale (MetaMonitor *monitor,
|
|||||||
case META_CONNECTOR_TYPE_HDMIA:
|
case META_CONNECTOR_TYPE_HDMIA:
|
||||||
case META_CONNECTOR_TYPE_HDMIB:
|
case META_CONNECTOR_TYPE_HDMIB:
|
||||||
if (resolution_width < SMALLEST_4K_WIDTH)
|
if (resolution_width < SMALLEST_4K_WIDTH)
|
||||||
goto out;
|
return scale;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -1693,7 +1693,7 @@ calculate_scale (MetaMonitor *monitor,
|
|||||||
* size.
|
* size.
|
||||||
*/
|
*/
|
||||||
if (meta_monitor_has_aspect_as_size (monitor))
|
if (meta_monitor_has_aspect_as_size (monitor))
|
||||||
goto out;
|
return scale;
|
||||||
|
|
||||||
if (width_mm > 0 && height_mm > 0)
|
if (width_mm > 0 && height_mm > 0)
|
||||||
{
|
{
|
||||||
@ -1710,7 +1710,6 @@ calculate_scale (MetaMonitor *monitor,
|
|||||||
scale = 2.0;
|
scale = 2.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
return scale;
|
return scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1780,7 +1779,7 @@ get_closest_scale_factor_for_resolution (float width,
|
|||||||
best_scale = 0;
|
best_scale = 0;
|
||||||
|
|
||||||
if (!is_scale_valid_for_size (width, height, scale))
|
if (!is_scale_valid_for_size (width, height, scale))
|
||||||
goto out;
|
return best_scale;
|
||||||
|
|
||||||
if (fmodf (width, scale) == 0.0 && fmodf (height, scale) == 0.0)
|
if (fmodf (width, scale) == 0.0 && fmodf (height, scale) == 0.0)
|
||||||
return scale;
|
return scale;
|
||||||
@ -1805,7 +1804,7 @@ get_closest_scale_factor_for_resolution (float width,
|
|||||||
current_scale < MINIMUM_SCALE_FACTOR ||
|
current_scale < MINIMUM_SCALE_FACTOR ||
|
||||||
current_scale > MAXIMUM_SCALE_FACTOR)
|
current_scale > MAXIMUM_SCALE_FACTOR)
|
||||||
{
|
{
|
||||||
goto out;
|
return best_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (floorf (scaled_h) == scaled_h)
|
if (floorf (scaled_h) == scaled_h)
|
||||||
@ -1821,7 +1820,6 @@ get_closest_scale_factor_for_resolution (float width,
|
|||||||
}
|
}
|
||||||
while (!found_one);
|
while (!found_one);
|
||||||
|
|
||||||
out:
|
|
||||||
return best_scale;
|
return best_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user