diff options
Diffstat (limited to 'win32/ScintillaWin.cxx')
-rw-r--r-- | win32/ScintillaWin.cxx | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index f8d884a98..e300253de 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -580,15 +580,19 @@ LRESULT ScintillaWin::WndPaint(uptr_t wParam) { } } else { #if defined(USE_D2D) - EnsureRenderTarget(); - AutoSurface surfaceWindow(pRenderTarget, this); - if (surfaceWindow) { - pRenderTarget->BeginDraw(); - Paint(surfaceWindow, rcPaint); - surfaceWindow->Release(); - HRESULT hr = pRenderTarget->EndDraw(); - if (hr == D2DERR_RECREATE_TARGET) { - DropRenderTarget(); + for (int attempt=0;attempt<2;attempt++) { + EnsureRenderTarget(); + AutoSurface surfaceWindow(pRenderTarget, this); + if (surfaceWindow) { + pRenderTarget->BeginDraw(); + Paint(surfaceWindow, rcPaint); + surfaceWindow->Release(); + HRESULT hr = pRenderTarget->EndDraw(); + if (hr == D2DERR_RECREATE_TARGET) { + DropRenderTarget(); + } else { + break; + } } } #endif |