Fix GNW color indexes

This commit is contained in:
Alexander Batalov 2023-07-19 12:01:20 +03:00
parent 3a17818ceb
commit 8414effc04
2 changed files with 12 additions and 13 deletions

View File

@ -549,9 +549,9 @@ void windowDrawText(int win, const char* str, int width, int x, int y, int color
}
}
if (color & 0xFF00) {
int t = (color & 0xFF00) >> 8;
textColor = (color & ~0xFFFF) | _colorTable[_GNW_wcolor[t]];
if ((color & 0xFF00) != 0) {
int colorIndex = (color & 0xFF) - 1;
textColor = (color & ~0xFFFF) | _colorTable[_GNW_wcolor[colorIndex]];
} else {
textColor = color;
}
@ -582,9 +582,9 @@ void windowDrawLine(int win, int left, int top, int right, int bottom, int color
return;
}
if (color & 0xFF00) {
int t = (color & 0xFF00) >> 8;
color = (color & ~0xFFFF) | _colorTable[_GNW_wcolor[t]];
if ((color & 0xFF00) != 0) {
int colorIndex = (color & 0xFF) - 1;
color = (color & ~0xFFFF) | _colorTable[_GNW_wcolor[colorIndex]];
}
bufferDrawLine(window->buffer, window->width, left, top, right, bottom, color);
@ -604,8 +604,8 @@ void windowDrawRect(int win, int left, int top, int right, int bottom, int color
}
if ((color & 0xFF00) != 0) {
int v1 = (color & 0xFF00) >> 8;
color = (color & ~0xFFFF) | _colorTable[_GNW_wcolor[v1]];
int colorIndex = (color & 0xFF) - 1;
color = (color & ~0xFFFF) | _colorTable[_GNW_wcolor[colorIndex]];
}
if (right < left) {
@ -643,8 +643,8 @@ void windowFill(int win, int x, int y, int width, int height, int color)
color = _colorTable[_GNW_wcolor[0]] & 0xFF;
}
} else if ((color & 0xFF00) != 0) {
int v1 = (color & 0xFF00) >> 8;
color = (color & ~0xFFFF) | _colorTable[_GNW_wcolor[v1]];
int colorIndex = (color & 0xFF) - 1;
color = (color & ~0xFFFF) | _colorTable[_GNW_wcolor[colorIndex]];
}
if (color < 256) {

View File

@ -645,9 +645,8 @@ int _win_msg(const char* string, int x, int y, int color)
int textColor;
if ((color & 0xFF00) != 0) {
int index = (color & 0xFF) - 1;
textColor = _colorTable[_GNW_wcolor[index]];
textColor |= color & ~0xFFFF;
int colorIndex = (color & 0xFF) - 1;
textColor = (color & ~0xFFFF) | _colorTable[_GNW_wcolor[colorIndex]];
} else {
textColor = color;
}