mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 07:30:42 -05:00
monitor: Never return fractional scale values when NO_FRAC is used
We introduced META_MONITOR_SCALES_CONSTRAINT_NO_FRAC to get global scale values however, this didn't work properly for some resolutions. In fact it may happen that for some resolutions (such as 3200x1800) that we did not compute some odd scaling levels (such as 3.0) but instead its closest fractional value that allowed to get an integer resolution (2.98507452 in this case). Now this is something relevant when using fractional scaling because we want to ensure that the returned value, when multiplied to the scaled sizes, will produce an integer resolution, but it's not in global scale mode where we don't use a scaled framebuffer. So, take a short path when using no fractional mode and just return all the applicable values without waste iterations on fractional values. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1878>
This commit is contained in:
parent
f6e2059a65
commit
98f3f96978
@ -1841,28 +1841,27 @@ meta_monitor_calculate_supported_scales (MetaMonitor *monitor,
|
||||
i <= ceilf (MAXIMUM_SCALE_FACTOR);
|
||||
i++)
|
||||
{
|
||||
for (j = 0; j < SCALE_FACTORS_PER_INTEGER; j++)
|
||||
if (constraints & META_MONITOR_SCALES_CONSTRAINT_NO_FRAC)
|
||||
{
|
||||
float scale;
|
||||
float scale_value = i + j * SCALE_FACTORS_STEPS;
|
||||
|
||||
if (constraints & META_MONITOR_SCALES_CONSTRAINT_NO_FRAC)
|
||||
if (is_scale_valid_for_size (width, height, i))
|
||||
{
|
||||
if (fmodf (scale_value, 1.0) != 0.0 ||
|
||||
!is_scale_valid_for_size (width, height, scale_value))
|
||||
continue;
|
||||
|
||||
scale = scale_value;
|
||||
float scale = i;
|
||||
g_array_append_val (supported_scales, scale);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < SCALE_FACTORS_PER_INTEGER; j++)
|
||||
{
|
||||
scale = get_closest_scale_factor_for_resolution (width,
|
||||
height,
|
||||
float scale;
|
||||
float scale_value = i + j * SCALE_FACTORS_STEPS;
|
||||
|
||||
scale = get_closest_scale_factor_for_resolution (width, height,
|
||||
scale_value);
|
||||
}
|
||||
|
||||
if (scale > 0.0f)
|
||||
g_array_append_val (supported_scales, scale);
|
||||
if (scale > 0.0)
|
||||
g_array_append_val (supported_scales, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user