From 7ec2a1c1488196b095606f70da24a096d0a2625b Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Thu, 29 Dec 2022 21:59:00 -0500 Subject: [PATCH] Use doubles as requested --- src/printer/prt_escp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index b2827e3f9..e7c9e0442 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -444,16 +444,16 @@ fill_palette(uint8_t redmax, uint8_t greenmax, uint8_t bluemax, uint8_t colorID, uint8_t colormask; int i; - float red = (float) redmax / (float) 30.9; - float green = (float) greenmax / (float) 30.9; - float blue = (float) bluemax / (float) 30.9; + double red = (double) redmax / (double) 30.9; + double green = (double) greenmax / (double) 30.9; + double blue = (double) bluemax / (double) 30.9; colormask = colorID <<= 5; for (i = 0; i < 32; i++) { - dev->palcol[i + colormask].r = 255 - (uint8_t) floor((double) red * (float) i); - dev->palcol[i + colormask].g = 255 - (uint8_t) floor((double) green * (float) i); - dev->palcol[i + colormask].b = 255 - (uint8_t) floor((double) blue * (float) i); + dev->palcol[i + colormask].r = 255 - (uint8_t) floor(red * (double) i); + dev->palcol[i + colormask].g = 255 - (uint8_t) floor(green * (double) i); + dev->palcol[i + colormask].b = 255 - (uint8_t) floor(blue * (double) i); } }