further improvement on tga import
This commit is contained in:
parent
1c5631a5e0
commit
a14229aa71
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue