From b623f5953691b2a0614e6f1f4def86bdbb9a4113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 8 Aug 2020 11:53:00 +0200 Subject: New upstream version 5.2.0Beta2.1 --- app/wlib/gtklib/color.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'app/wlib/gtklib/color.c') diff --git a/app/wlib/gtklib/color.c b/app/wlib/gtklib/color.c index 64b96ef..e1689d2 100644 --- a/app/wlib/gtklib/color.c +++ b/app/wlib/gtklib/color.c @@ -100,7 +100,7 @@ static colorMap_t colorMap[] = { { 208, 208, 208 }, /* Gray */ { 224, 224, 224 }, /* Gray */ { 240, 240, 240 }, /* Gray */ - { 0, 0, 0 } /* BlackPixel */ + { 255, 255, 255 } /* WhitePixel */ }; #define NUM_GRAYS (16) @@ -125,7 +125,7 @@ wDrawColor wDrawColorGray( if (n <= 0) { return wDrawColorBlack; - } else if (n > NUM_GRAYS) { + } else if (n >= NUM_GRAYS) { return wDrawColorWhite; } else { n = (n*256)/NUM_GRAYS; @@ -209,7 +209,7 @@ wDrawColor wDrawFindColor( long rgb0) { wDrawColor cc; - int r0, g0, b0; + int r0, g0, b0, r1, g1, b1; int d0; int i; colorMap_t tempMapValue; @@ -231,7 +231,10 @@ wDrawColor wDrawFindColor( colorMap_t * cm_p; cm_p = &g_array_index(colorMap_garray, colorMap_t, i); - d1 = abs(r0-cm_p->red) + abs(g0-cm_p->green) + abs(b0-cm_p->blue); + r1 = (int)cm_p->red; + g1 = (int)cm_p->green; + b1 = (int)cm_p->blue; + d1 = abs(r0-r1) + abs(g0-g1) + abs(b0-b1); if (d1 == 0) { return i; -- cgit v1.2.3