From 662b5d5f413a1bfcde16ce8f00cd28f06084a573 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 25 Apr 2013 10:23:32 +1000 Subject: Fix Direct2D drawing when returning from lock screen. --- doc/ScintillaHistory.html | 9 ++++++++- win32/ScintillaWin.cxx | 22 +++++++++++++--------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 1e8facbf7..1dd2ed9a7 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -473,8 +473,15 @@ Composition popups appear near input.
  • + Fix lexer problem where no line end was seen at end of document. +
  • +
  • Fix crash on Cocoa when view deallocated. - Bug #1466, + Bug #1466. +
  • +
  • + Fix drawing on Windows with Direct2D when returning from lock screen. + The render target had to be recreated and an area would be black since the drawing was not retried.
  • Fix display of DBCS documents on Windows Direct2D/DirectWrite with default character set. 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 -- cgit v1.2.3