Skip to content

Commit 1bb1450

Browse files
fix PaletteFade and DrawTintRect
1 parent cdfe25c commit 1bb1450

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Nexus/Drawing.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ void DrawTintRectangle(int XPos, int YPos, int width, int height, byte tintID)
16341634
height += YPos;
16351635
YPos = 0;
16361636
}
1637-
if (width <= 0 || height <= 0)
1637+
if (width < 0 || height < 0)
16381638
return;
16391639

16401640
byte *tintTable = NULL;
@@ -1649,7 +1649,7 @@ void DrawTintRectangle(int XPos, int YPos, int width, int height, byte tintID)
16491649
int yOffset = SCREEN_XSIZE - width;
16501650
for (byte *pixelBufferPtr = &Engine.pixelBuffer[XPos + SCREEN_XSIZE * YPos];; pixelBufferPtr += yOffset) {
16511651
height--;
1652-
if (!height)
1652+
if (height < 0)
16531653
break;
16541654
int w = width;
16551655
while (w--) {

Nexus/Palette.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void SetFade(byte r, byte g, byte b, ushort a, int start, int end)
4343
a = 255;
4444
if (end < 256)
4545
++end;
46-
for (int i = start; i < end; ++i) {
46+
for (int i = start; i <= end; ++i) {
4747
byte red = (ushort)(r * a + (0xFF - a) * palette8[i].r) >> 8;
4848
byte green = (ushort)(g * a + (0xFF - a) * palette8[i].g) >> 8;
4949
byte blue = (ushort)(b * a + (0xFF - a) * palette8[i].b) >> 8;

0 commit comments

Comments
 (0)