From 75972799fb9c80628be15375d80fb485509f2fee Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 3 Jun 2016 20:12:14 +0300 Subject: [PATCH] Fall back to original GDI capture mode if D3D mode fails. --- od-win32/screenshot.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/od-win32/screenshot.cpp b/od-win32/screenshot.cpp index 2fa47a28..8f75730f 100644 --- a/od-win32/screenshot.cpp +++ b/od-win32/screenshot.cpp @@ -366,6 +366,7 @@ static int screenshot_prepare (int imagemode, struct vidbuffer *vb) } else { donormal: + bool d3dcaptured = false; width = WIN32GFX_GetWidth (); height = WIN32GFX_GetHeight (); @@ -429,10 +430,12 @@ donormal: } } s->UnlockRect(); + d3dcaptured = true; } } - } else { + } + if (!d3dcaptured) { surface_dc = gethdc (); if (surface_dc == NULL) goto oops; @@ -653,10 +656,14 @@ int screenshotf (const TCHAR *spath, int mode, int doprepare, int imagemode, str else #endif failed = savebmp (fp); - fclose (fp); + fclose(fp); fp = NULL; - goto oops; + if (failed) + write_log(_T("Screenshot status %d ('%s')\n"), failed, spath); + if (failed) + _tunlink(spath); } + goto oops; } fetch_path (_T("ScreenshotPath"), path, sizeof (path) / sizeof (TCHAR)); CreateDirectory (path, NULL); -- 2.47.3