mirror of
https://github.com/brl/mutter.git
synced 2024-11-10 07:56:14 -05:00
monitor-config: Handle fractional scale precision loss
When calculating sizes given some size and a fractional logical monitor scale with precision loss, round the result of the floating point calculation to the closest integer, as otherwise we might end up with result smaller by 1 if there was a loss of precision when calculating the scale. https://bugzilla.gnome.org/show_bug.cgi?id=765011
This commit is contained in:
parent
197401fbf8
commit
41eea5a942
@ -981,8 +981,10 @@ meta_verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor
|
||||
switch (layout_mode)
|
||||
{
|
||||
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
|
||||
expected_mode_width *= logical_monitor_config->scale;
|
||||
expected_mode_height *= logical_monitor_config->scale;
|
||||
expected_mode_width = roundf (expected_mode_width *
|
||||
logical_monitor_config->scale);
|
||||
expected_mode_height = roundf (expected_mode_height *
|
||||
logical_monitor_config->scale);
|
||||
break;
|
||||
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
|
||||
break;
|
||||
|
@ -453,8 +453,8 @@ derive_logical_monitor_layout (MetaLogicalMonitorConfig *logical_monitor_conf
|
||||
switch (layout_mode)
|
||||
{
|
||||
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
|
||||
width /= logical_monitor_config->scale;
|
||||
height /= logical_monitor_config->scale;
|
||||
width = roundf (width / logical_monitor_config->scale);
|
||||
height = roundf (height / logical_monitor_config->scale);
|
||||
break;
|
||||
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
|
||||
break;
|
||||
|
@ -1968,8 +1968,8 @@ derive_logical_monitor_size (MetaMonitorConfig *monitor_config,
|
||||
switch (layout_mode)
|
||||
{
|
||||
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
|
||||
width /= scale;
|
||||
height /= scale;
|
||||
width = roundf (width / scale);
|
||||
height = roundf (height / scale);
|
||||
break;
|
||||
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user