Implement multi-monitor screenshots

This commit is contained in:
Cacodemon345
2022-07-07 16:09:50 +06:00
parent b9316be98f
commit e287886dfb
4 changed files with 9 additions and 6 deletions

View File

@@ -153,7 +153,7 @@ void D3D9Renderer::blit(int x, int y, int w, int h)
srcRect.right = source.right();
if (screenshots) {
video_screenshot((uint32_t *) &(buffer32->line[y][x]), 0, 0, 2048);
video_screenshot_monitor((uint32_t *) &(monitors[m_monitor_index].target_buffer->line[y][x]), 0, 0, 2048, m_monitor_index);
}
if (SUCCEEDED(d3d9surface->LockRect(&lockRect, &srcRect, 0))) {
for (int y1 = 0; y1 < h; y1++) {

View File

@@ -1925,7 +1925,8 @@ void MainWindow::on_actionUpdate_status_bar_icons_triggered()
void MainWindow::on_actionTake_screenshot_triggered()
{
startblit();
screenshots++;
for (int i = 0; i < MONITORS_NUM; i++)
monitors[i].mon_screenshots++;
endblit();
device_force_redraw();
}

View File

@@ -437,8 +437,8 @@ RendererStack::blitCommon(int x, int y, int w, int h)
video_copy(scanline, &(monitors[m_monitor_index].target_buffer->line[y1][x]), w * 4);
}
if (screenshots) {
video_screenshot((uint32_t *) imagebits, x, y, 2048);
if (monitors[m_monitor_index].mon_screenshots) {
video_screenshot_monitor((uint32_t *) imagebits, x, y, 2048, m_monitor_index);
}
video_blit_complete_monitor(m_monitor_index);
emit blitToRenderer(currentBuf, sx, sy, sw, sh);

View File

@@ -420,7 +420,7 @@ video_take_screenshot_monitor(const char *fn, uint32_t *buf, int start_x, int st
void
video_screenshot_monitor(uint32_t *buf, int start_x, int start_y, int row_len, int monitor_index)
{
char path[1024], fn[128];
char path[1024], fn[256];
memset(fn, 0, sizeof(fn));
memset(path, 0, sizeof(path));
@@ -431,6 +431,8 @@ video_screenshot_monitor(uint32_t *buf, int start_x, int start_y, int row_len, i
plat_dir_create(path);
path_slash(path);
strcat(path, "Monitor_");
snprintf(&path[strlen(path)], 42, "%d_", monitor_index + 1);
plat_tempfile(fn, NULL, ".png");
strcat(path, fn);
@@ -446,7 +448,7 @@ video_screenshot_monitor(uint32_t *buf, int start_x, int start_y, int row_len, i
void
video_screenshot(uint32_t *buf, int start_x, int start_y, int row_len)
{
video_screenshot_monitor(buf, start_x, start_y, row_len, monitor_index_global);
video_screenshot_monitor(buf, start_x, start_y, row_len, 0);
}