DumpTGA: fix TGA header to account for alpha channel

This commit is contained in:
Iliyas Jorio 2020-12-01 17:30:14 +01:00
parent 61d2c01102
commit ffc5a80b9c
1 changed files with 1 additions and 2 deletions

View File

@ -62,7 +62,7 @@ std::ostream& operator<<(std::ostream& s, const Rect& r)
void Pomme::Graphics::DumpTGA(const char* path, short width, short height, const char* argbData)
{
std::ofstream tga(path);
short tgaHdr[] = {0, 2, 0, 0, 0, 0, (short) width, (short) height, 0x2020};
uint16_t tgaHdr[] = {0, 2, 0, 0, 0, 0, (uint16_t) width, (uint16_t) height, 0x2820};
tga.write((const char*) tgaHdr, sizeof(tgaHdr));
for (int i = 0; i < 4 * width * height; i += 4)
{
@ -72,7 +72,6 @@ void Pomme::Graphics::DumpTGA(const char* path, short width, short height, const
tga.put(argbData[i + 0]); //a
}
tga.close();
std::cout << "wrote " << path << "\n";
}
//-----------------------------------------------------------------------------