Fix screenshots to be right side up, not crash.

This commit is contained in:
Unknown W. Brackets 2015-11-02 19:43:36 -08:00
parent b7242a617b
commit 869260087c
2 changed files with 4 additions and 3 deletions

View File

@ -259,7 +259,7 @@ bool TakeGameScreenshot(const char *filename, ScreenshotFormat fmt, ScreenshotTy
png.format = PNG_FORMAT_RGB;
png.width = buf.GetStride();
png.height = buf.GetHeight();
success = WriteScreenshotToPNG(&png, filename, 0, flipbuffer, buf.GetStride() * 3, nullptr);
success = WriteScreenshotToPNG(&png, filename, 0, buffer, buf.GetStride() * 3, nullptr);
png_image_free(&png);
if (png.warning_or_error >= 2) {
@ -269,7 +269,7 @@ bool TakeGameScreenshot(const char *filename, ScreenshotFormat fmt, ScreenshotTy
} else if (success && fmt == SCREENSHOT_JPG) {
jpge::params params;
params.m_quality = 90;
success = WriteScreenshotToJPEG(filename, buf.GetStride(), buf.GetHeight(), 3, flipbuffer, params);
success = WriteScreenshotToJPEG(filename, buf.GetStride(), buf.GetHeight(), 3, buffer, params);
} else {
success = false;
}

View File

@ -1913,7 +1913,8 @@ bool FramebufferManager::GetDisplayFramebuffer(GPUDebugBuffer &buffer) {
int pw = PSP_CoreParameter().pixelWidth;
int ph = PSP_CoreParameter().pixelHeight;
buffer.Allocate(pw, ph, GPU_DBG_FORMAT_888_RGB, false);
// The backbuffer is flipped.
buffer.Allocate(pw, ph, GPU_DBG_FORMAT_888_RGB, true);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, pw, ph, GL_RGB, GL_UNSIGNED_BYTE, buffer.GetData());
return true;