Screenshot capability of Software rasterizer for feature completness.

This commit is contained in:
Ryan Houdek
2013-11-15 22:07:08 -06:00
parent 23c84c220f
commit e8a4cc0f71
4 changed files with 33 additions and 5 deletions

View File

@ -1810,7 +1810,7 @@ bool Renderer::SaveScreenshot(const std::string &filename, const TargetRectangle
{
u32 W = back_rc.GetWidth();
u32 H = back_rc.GetHeight();
u8 *data = (u8 *)malloc((sizeof(u8) * 4 * W * H));
u8 *data = new u8[W * 4 * H];
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(back_rc.left, back_rc.bottom, W, H, GL_RGBA, GL_UNSIGNED_BYTE, data);
@ -1825,7 +1825,6 @@ bool Renderer::SaveScreenshot(const std::string &filename, const TargetRectangle
// Turn image upside down
FlipImageData(data, W, H, 4);
return TextureToPng(data, W*4, filename.c_str(), W, H, false);
}