mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
util: reduce error of wl_fixed_from_double()
when cast double to fixed pointer, there will be big error, eg 1919.9998 to 1919. Call round before cast to get nearest value 1920 of 1919.9998 Signed-off-by: Haihua Hu <jared.hu@nxp.com>
This commit is contained in:
parent
9cb3d7aa9d
commit
f246e619d1
1 changed files with 1 additions and 1 deletions
|
|
@ -635,7 +635,7 @@ wl_fixed_to_double(wl_fixed_t f)
|
|||
static inline wl_fixed_t
|
||||
wl_fixed_from_double(double d)
|
||||
{
|
||||
return (wl_fixed_t) (d * 256.0);
|
||||
return (wl_fixed_t) (round(d * 256.0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue