summaryrefslogtreecommitdiff
path: root/app/wlib/gtklib/color.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-24 21:26:53 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-24 21:26:53 +0200
commitdf247efec654e512242e4f4f1b0212034f9e01fe (patch)
tree25c02e16957f3aa613af30c140fd8e8a3d52fda6 /app/wlib/gtklib/color.c
parentd0b6a8a4ec298024f14f704f9e40a6f9d324ccf3 (diff)
parenta5ade52caa489cf0a713e0f02b764000d203140e (diff)
Merge branch 'release/debian/1%5.2.0Beta2.1-1' into masterHEADdebian/1%5.2.0Beta2.1-1master
Diffstat (limited to 'app/wlib/gtklib/color.c')
-rw-r--r--app/wlib/gtklib/color.c11
1 files changed, 7 insertions, 4 deletions
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;