mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
renderer/native: Round calculated framebuffer size before casting to int
Due to rounding issues, we can't assume a floating point calculation will end up on an integer, even if we got the factor from the reverse calculation. Thus, to avoid casting away values like N.999... to N, when they should really be N+1, round the resulting floating point calculation before casting it to int. This fixes an issue where using the scale ~1.739 on a 1920x1080 mode resulted in error when setting the mode, as the calculated size of the framebuffer was only 1919x1080. https://bugzilla.gnome.org/show_bug.cgi?id=786918
This commit is contained in:
parent
94a15404da
commit
8a32b42172
@ -1719,8 +1719,8 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
||||
else
|
||||
scale = 1.0;
|
||||
|
||||
width = logical_monitor->rect.width * scale;
|
||||
height = logical_monitor->rect.height * scale;
|
||||
width = roundf (logical_monitor->rect.width * scale);
|
||||
height = roundf (logical_monitor->rect.height * scale);
|
||||
|
||||
onscreen = meta_renderer_native_create_onscreen (META_RENDERER_NATIVE (renderer),
|
||||
cogl_context,
|
||||
|
Loading…
Reference in New Issue
Block a user