summaryrefslogtreecommitdiff
path: root/dw
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-08-12 23:47:24 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-10-17 20:37:54 +0200
commit25a381f61308794f20796596a02ae67a1d55b7fc (patch)
tree71bb79c41b02c4099f54bb0bf09bb18ee47ea395 /dw
parent277b72c715df6934b261b2c743f64e26ab49633a (diff)
Round final relative CSS length
Prevents errors by one pixel
Diffstat (limited to 'dw')
-rw-r--r--dw/style.hh3
1 files changed, 2 insertions, 1 deletions
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 <stdint.h>
+#include <math.h>
#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));
}
/**