aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/ScintillaWin.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'win32/ScintillaWin.cxx')
-rw-r--r--win32/ScintillaWin.cxx72
1 files changed, 32 insertions, 40 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index d375c7ca8..f57c47d9c 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -334,6 +334,8 @@ class ScintillaWin :
Sci::Position TargetAsUTF8(char *text) const;
void AddCharUTF16(wchar_t const *wcs, unsigned int wclen, CharacterSource charSource);
Sci::Position EncodedFromUTF8(const char *utf8, char *encoded) const;
+
+ bool PaintDC(HDC hdc);
sptr_t WndPaint();
sptr_t HandleCompositionWindowed(uptr_t wParam, sptr_t lParam);
@@ -838,31 +840,17 @@ void ScintillaWin::AddCharUTF16(wchar_t const *wcs, unsigned int wclen, Characte
}
}
-sptr_t ScintillaWin::WndPaint() {
- //ElapsedPeriod ep;
-
- // Redirect assertions to debug output and save current state
- const bool assertsPopup = Platform::ShowAssertionPopUps(false);
- paintState = painting;
- PAINTSTRUCT ps = {};
-
- // Removed since this interferes with reporting other assertions as it occurs repeatedly
- //PLATFORM_ASSERT(hRgnUpdate == NULL);
- hRgnUpdate = ::CreateRectRgn(0, 0, 0, 0);
- ::GetUpdateRgn(MainHWND(), hRgnUpdate, FALSE);
- ::BeginPaint(MainHWND(), &ps);
- rcPaint = PRectangle::FromInts(ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom);
- const PRectangle rcClient = GetClientRectangle();
- paintingAllText = BoundsContains(rcPaint, hRgnUpdate, rcClient);
+bool ScintillaWin::PaintDC(HDC hdc) {
if (technology == SC_TECHNOLOGY_DEFAULT) {
- AutoSurface surfaceWindow(ps.hdc, this);
+ AutoSurface surfaceWindow(hdc, this);
if (surfaceWindow) {
Paint(surfaceWindow, rcPaint);
surfaceWindow->Release();
}
} else {
#if defined(USE_D2D)
- EnsureRenderTarget(ps.hdc);
+ EnsureRenderTarget(hdc);
+ if (pRenderTarget) {
AutoSurface surfaceWindow(pRenderTarget, this);
if (surfaceWindow) {
pRenderTarget->BeginDraw();
@@ -871,11 +859,35 @@ sptr_t ScintillaWin::WndPaint() {
const HRESULT hr = pRenderTarget->EndDraw();
if (hr == static_cast<HRESULT>(D2DERR_RECREATE_TARGET)) {
DropRenderTarget();
- paintState = paintAbandoned;
+ return false;
+ }
}
}
#endif
}
+
+ return true;
+}
+
+sptr_t ScintillaWin::WndPaint() {
+ //ElapsedPeriod ep;
+
+ // Redirect assertions to debug output and save current state
+ const bool assertsPopup = Platform::ShowAssertionPopUps(false);
+ paintState = painting;
+ PAINTSTRUCT ps = {};
+
+ // Removed since this interferes with reporting other assertions as it occurs repeatedly
+ //PLATFORM_ASSERT(hRgnUpdate == NULL);
+ hRgnUpdate = ::CreateRectRgn(0, 0, 0, 0);
+ ::GetUpdateRgn(MainHWND(), hRgnUpdate, FALSE);
+ ::BeginPaint(MainHWND(), &ps);
+ rcPaint = PRectangle::FromInts(ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom);
+ const PRectangle rcClient = GetClientRectangle();
+ paintingAllText = BoundsContains(rcPaint, hRgnUpdate, rcClient);
+ if (!PaintDC(ps.hdc)) {
+ paintState = paintAbandoned;
+ }
if (hRgnUpdate) {
::DeleteRgn(hRgnUpdate);
hRgnUpdate = 0;
@@ -2995,27 +3007,7 @@ void ScintillaWin::FullPaintDC(HDC hdc) {
paintState = painting;
rcPaint = GetClientRectangle();
paintingAllText = true;
- if (technology == SC_TECHNOLOGY_DEFAULT) {
- AutoSurface surfaceWindow(hdc, this);
- if (surfaceWindow) {
- Paint(surfaceWindow, rcPaint);
- surfaceWindow->Release();
- }
- } else {
-#if defined(USE_D2D)
- EnsureRenderTarget(hdc);
- AutoSurface surfaceWindow(pRenderTarget, this);
- if (surfaceWindow) {
- pRenderTarget->BeginDraw();
- Paint(surfaceWindow, rcPaint);
- surfaceWindow->Release();
- const HRESULT hr = pRenderTarget->EndDraw();
- if (hr == static_cast<HRESULT>(D2DERR_RECREATE_TARGET)) {
- DropRenderTarget();
- }
- }
-#endif
- }
+ PaintDC(hdc);
paintState = notPainting;
}