util: make a float to int conversion explicit
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 19 Jun 2024 23:50:15 +0000 (09:50 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 29 Oct 2024 00:18:54 +0000 (10:18 +1000)
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1071>

src/util-matrix.h

index 09ac99e40f4a6ac1629b21a0fb563ba554533c93..6a09803ddf3adb4eb1445c832f060c9b56f167ab 100644 (file)
@@ -136,13 +136,13 @@ matrix_mult(struct matrix *dest,
 static inline void
 matrix_mult_vec(const struct matrix *m, int *x, int *y)
 {
-       int tx, ty;
+       float tx, ty;
 
        tx = *x * m->val[0][0] + *y * m->val[0][1] + m->val[0][2];
        ty = *x * m->val[1][0] + *y * m->val[1][1] + m->val[1][2];
 
-       *x = tx;
-       *y = ty;
+       *x = (int)tx;
+       *y = (int)ty;
 }
 
 static inline void