Skip to content
Snippets Groups Projects
Commit a14229aa authored by Anakin's avatar Anakin
Browse files

further improvement on tga import

parent 1c5631a5
No related branches found
No related tags found
No related merge requests found
......@@ -61,20 +61,17 @@ QImage loadTga(QString filePath, bool &success)
for (unsigned int y = 0; y < ui32Height; y++)
{
//QRgb* imgLine = (QRgb*)img.scanLine(y);
QRgb* imgLine = reinterpret_cast<QRgb*>(img.scanLine(ui32Height - y - 1));
for (unsigned int x = 0; x < ui32Width; x++)
{
int valr = vui8Pixels.at(y * ui32Width * ui32BpP / 8 + x * ui32BpP / 8 + 2);
int valr = vui8Pixels.at(y * ui32Width * ui32BpP / 8 + x * ui32BpP / 8);
int valg = vui8Pixels.at(y * ui32Width * ui32BpP / 8 + x * ui32BpP / 8 + 1);
int valb = vui8Pixels.at(y * ui32Width * ui32BpP / 8 + x * ui32BpP / 8);
int valb = vui8Pixels.at(y * ui32Width * ui32BpP / 8 + x * ui32BpP / 8 + 2);
int vala = 255;
if (ui32BpP == 32)
vala = vui8Pixels.at(y * ui32Width * ui32BpP / 8 + x * ui32BpP / 8 + 3);
QColor value(valr, valg, valb, vala);
//imgLine[x] = value.rgba();
img.setPixel(x, ui32Width - 1 - y, value.rgba());
imgLine[x] = QColor(valr, valg, valb, vala).rgba();
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment