Andrettin / Wyrmsun

Strategy game based on history, mythology and fiction
http://andrettin.github.io/
GNU General Public License v2.0
307 stars 48 forks source link

[5.3.4] Screen capture duplicates the first screenshot #204

Open SenhorFlibble opened 2 years ago

SenhorFlibble commented 2 years ago

Discovered another bug.

If you take more than one screenshot by pressing F11 during a playing session, only the first screenshot is captured properly, all others are just copies of the first one.

It seems like the screen capture function does not clear the video buffer or something.

Andrettin commented 2 years ago

I cannot reproduce the issue, unfortunately. When I take screenshots using F11, the 1st/2nd/3rd screenshots (screen01.png/screen02.png/screen03.png) are all different.

SenhorFlibble commented 2 years ago

JIC, I'm on Windows 8.1.

Maybe I should update some of the libraries?

Andrettin commented 2 years ago

JIC, I'm on Windows 8.1.

Maybe I should update some of the libraries?

Maybe the Windows version could be related to it. In the engine the amount of code for creating a screenshot is relatively small:

{
    const QWindow *window = QApplication::focusWindow();

    if (window == nullptr) {
        return;
    }

    const QPixmap screen_pixmap = window->screen()->grabWindow(window->winId());
    screen_pixmap.save(name);
}

It could be that a setting somewhere else is causing the problem, but it's also possible that the Qt framework has a bug in interacting with Windows 8 for taking screenshots (the classes beginning with "Q" are from the Qt framework).

I searched their bug database for a bug related to QScreen::grabWindow() always providing the same result, but I couldn't find anything, though.