This commit is contained in:
Branimir Karadžić 2018-03-20 17:54:30 -07:00
parent f10d4c1646
commit b48813cf48

View File

@ -69,13 +69,13 @@ static const uint16_t s_cubeIndices[36] =
6, 3, 7, 6, 3, 7,
}; };
void savePng(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip) void savePng(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bimg::TextureFormat::Enum _format, bool _yflip)
{ {
bx::FileWriter writer; bx::FileWriter writer;
bx::Error err; bx::Error err;
if (bx::open(&writer, _filePath, false, &err) ) if (bx::open(&writer, _filePath, false, &err) )
{ {
bimg::imageWritePng(&writer, _width, _height, _srcPitch, _src, _grayscale, _yflip, &err); bimg::imageWritePng(&writer, _width, _height, _srcPitch, _src, _format, _yflip, &err);
bx::close(&writer); bx::close(&writer);
} }
} }
@ -188,7 +188,7 @@ struct BgfxCallback : public bgfx::CallbackI
// Save screen shot as PNG. // Save screen shot as PNG.
bx::snprintf(temp, BX_COUNTOF(temp), "%s.png", _filePath); bx::snprintf(temp, BX_COUNTOF(temp), "%s.png", _filePath);
savePng(temp, _width, _height, _pitch, _data, false, _yflip); savePng(temp, _width, _height, _pitch, _data, bimg::TextureFormat::BGRA8, _yflip);
// Save screen shot as TGA. // Save screen shot as TGA.
bx::snprintf(temp, BX_COUNTOF(temp), "%s.tga", _filePath); bx::snprintf(temp, BX_COUNTOF(temp), "%s.tga", _filePath);