Skip to content

Commit

Permalink
Fixed|libgui: Red/blue channel swapping in TGA loader
Browse files Browse the repository at this point in the history
IssueID #2396
  • Loading branch information
skyjake committed Jan 7, 2020
1 parent 975a113 commit 6526d31
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doomsday/sdk/libgui/src/graphics/image.cpp
Expand Up @@ -340,7 +340,8 @@ static QImage load(Block const &data)

DENG2_ASSERT(header.mapIndex + i < 256);

colorTable[header.mapIndex + i] = qRgba(color[0], color[1], color[2], color[3]);
// R/B swapped
colorTable[header.mapIndex + i] = qRgba(color[2], color[1], color[0], color[3]);
}

img = QImage(QSize(header.size.x, header.size.y), QImage::Format_Indexed8);
Expand All @@ -355,7 +356,7 @@ static QImage load(Block const &data)
}
}

if (pixelSize == 3)
if (pixelSize >= 3)
{
img = img.rgbSwapped();
}
Expand Down

0 comments on commit 6526d31

Please sign in to comment.