mirror of
https://github.com/86Box/86Box.git
synced 2026-02-21 17:15:32 -07:00
OpenGL Renderer: Pad the line pitch to the nearest dword when taking non-raw screenshots, fixed messed up screenshots.
This commit is contained in:
@@ -1726,7 +1726,8 @@ OpenGLRenderer::render()
|
||||
glw.glFinish();
|
||||
glw.glReadPixels(window_rect.x, window_rect.y, width, height, GL_RGB, GL_UNSIGNED_BYTE, rgb);
|
||||
|
||||
QImage image((uchar*)rgb, width, height, width * 3, QImage::Format_RGB888);
|
||||
int pitch_adj = (4 - ((width * 3) & 3)) & 3;
|
||||
QImage image((uchar*)rgb, width, height, (width * 3) + pitch_adj, QImage::Format_RGB888);
|
||||
image.mirrored(false, true).save(path, "png");
|
||||
monitors[r_monitor_index].mon_screenshots--;
|
||||
free(rgb);
|
||||
@@ -1739,7 +1740,8 @@ OpenGLRenderer::render()
|
||||
glw.glFinish();
|
||||
glw.glReadPixels(window_rect.x, window_rect.y, width, height, GL_RGB, GL_UNSIGNED_BYTE, rgb);
|
||||
|
||||
QImage image((uchar*)rgb, width, height, width * 3, QImage::Format_RGB888);
|
||||
int pitch_adj = (4 - ((width * 3) & 3)) & 3;
|
||||
QImage image((uchar*)rgb, width, height, (width * 3) + pitch_adj, QImage::Format_RGB888);
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setImage(image.mirrored(false, true), QClipboard::Clipboard);
|
||||
monitors[r_monitor_index].mon_screenshots_clipboard--;
|
||||
|
||||
Reference in New Issue
Block a user