Commit a14229aa authored by Anakin's avatar Anakin
Browse files

further improvement on tga import

parent 1c5631a5
...@@ -61,20 +61,17 @@ QImage loadTga(QString filePath, bool &success) ...@@ -61,20 +61,17 @@ QImage loadTga(QString filePath, bool &success)
for (unsigned int y = 0; y < ui32Height; y++) 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++) 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 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; int vala = 255;
if (ui32BpP == 32) if (ui32BpP == 32)
vala = vui8Pixels.at(y * ui32Width * ui32BpP / 8 + x * ui32BpP / 8 + 3); vala = vui8Pixels.at(y * ui32Width * ui32BpP / 8 + x * ui32BpP / 8 + 3);
QColor value(valr, valg, valb, vala); imgLine[x] = QColor(valr, valg, valb, vala).rgba();
//imgLine[x] = value.rgba();
img.setPixel(x, ui32Width - 1 - y, value.rgba());
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment