From 4bae69ba3c01be59d8918c56c341af78fc09192a Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 11 Nov 2013 10:25:01 +1100 Subject: When Direct2D returns D2DERR_RECREATE_TARGET handle by complete redraw instead of trying to redraw just the initially required area. Reported to eliminate black window contents after system Lock and similar actions. --- doc/ScintillaHistory.html | 4 ++++ win32/ScintillaWin.cxx | 23 ++++++++++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index fb750e384..b2cc9c40f 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -483,6 +483,10 @@ Feature #887.
  • + Fix another problem with drawing on Windows with Direct2D when returning from lock screen. + The whole window is redrawn as just redrawing the initially required area left other areas black. +
  • +
  • When scroll width is tracked, take width of annotation lines into account.
  • diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 2ddc3944f..7bc05eec8 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -600,19 +600,16 @@ LRESULT ScintillaWin::WndPaint(uptr_t wParam) { } } else { #if defined(USE_D2D) - 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; - } + EnsureRenderTarget(); + AutoSurface surfaceWindow(pRenderTarget, this); + if (surfaceWindow) { + pRenderTarget->BeginDraw(); + Paint(surfaceWindow, rcPaint); + surfaceWindow->Release(); + HRESULT hr = pRenderTarget->EndDraw(); + if (hr == D2DERR_RECREATE_TARGET) { + DropRenderTarget(); + paintState = paintAbandoned; } } #endif -- cgit v1.2.3