From 25a381f61308794f20796596a02ae67a1d55b7fc Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 12 Aug 2024 23:47:24 +0200 Subject: Round final relative CSS length Prevents errors by one pixel --- dw/style.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dw/style.hh b/dw/style.hh index 12b7cbde..3cab376a 100644 --- a/dw/style.hh +++ b/dw/style.hh @@ -2,6 +2,7 @@ #define __DW_STYLE_HH__ #include +#include #ifndef __INCLUDED_FROM_DW_CORE_HH__ # error Do not include this file directly, use "core.hh" instead. @@ -471,7 +472,7 @@ inline double relLengthVal(Length l) { return (double)(l & ~3) / (1 << 18); } * Use this instead of perLengthVal, when possible. */ inline int multiplyWithPerLength(int x, Length l) { - return x * perLengthVal_useThisOnlyForDebugging (l); + return (int) round((double) x * perLengthVal_useThisOnlyForDebugging (l)); } /** -- cgit v1.2.3