From 09479b7fa19f1b09c9146cee1cea55925e4a6259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sun, 2 Jun 2019 15:24:47 +0200 Subject: [PATCH] Fix ocassional wrong sort --- small3dlib.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/small3dlib.h b/small3dlib.h index 7726b6c..95ad5e3 100644 --- a/small3dlib.h +++ b/small3dlib.h @@ -1277,11 +1277,11 @@ void S3L_drawTriangle( tPointSy = y##t;\ tPointPP = &point##t;\ barycentric2 = &(p.barycentric[t]);\ - int16_t aDx = x##a - x##t;\ - int16_t bDx = x##b - x##t;\ - int16_t aDy = S3L_nonZero(y##a - y##t);\ - int16_t bDy = S3L_nonZero(y##b - y##t);\ - if ((aDx << 5) / aDy < (bDx << 5) / bDy)\ + int32_t aDx = x##a - x##t;\ + int32_t bDx = x##b - x##t;\ + int32_t aDy = S3L_nonZero(y##a - y##t);\ + int32_t bDy = S3L_nonZero(y##b - y##t);\ + if ((aDx << 8) / aDy < (bDx << 8) / bDy)\ {\ lPointSx = x##a; lPointSy = y##a;\ rPointSx = x##b; rPointSy = y##b;\