aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/ScintillaWin.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2011-08-11 10:32:39 +1000
committernyamatongwe <devnull@localhost>2011-08-11 10:32:39 +1000
commitf09627bdb8c597bcc8055b6ce370062a06ad1c37 (patch)
tree559530ca5161394842d67a1677950f1b3863e75c /win32/ScintillaWin.cxx
parent6860b289d19541ccb8d5be31c81c0f1aa992e9d7 (diff)
downloadscintilla-mirror-f09627bdb8c597bcc8055b6ce370062a06ad1c37.tar.gz
Implemented parallel stacks for GDI and DirectWrite. GDI works
but DirectWrite does not draw well and eventuall crashes.
Diffstat (limited to 'win32/ScintillaWin.cxx')
-rw-r--r--win32/ScintillaWin.cxx53
1 files changed, 33 insertions, 20 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index b3b9d1bb0..525621b2c 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -383,8 +383,6 @@ void ScintillaWin::Initialise() {
::GetProcAddress(commctrl32, "_TrackMouseEvent");
}
}
-
- LoadD2D();
}
void ScintillaWin::Finalise() {
@@ -546,25 +544,35 @@ LRESULT ScintillaWin::WndPaint(uptr_t wParam) {
pps = &ps;
::BeginPaint(MainHWND(), pps);
}
- //AutoSurface surfaceWindow(pps->hdc, this);
- EnsureRenderTarget();
- AutoSurface surfaceWindow(pRenderTarget, this);
- if (surfaceWindow) {
- pRenderTarget->BeginDraw();
- rcPaint = PRectangle(pps->rcPaint.left, pps->rcPaint.top, pps->rcPaint.right, pps->rcPaint.bottom);
- PRectangle rcClient = GetClientRectangle();
- paintingAllText = rcPaint.Contains(rcClient);
- if (paintingAllText) {
- //Platform::DebugPrintf("Performing full text paint\n");
- } else {
- //Platform::DebugPrintf("Performing partial paint %d .. %d\n", rcPaint.top, rcPaint.bottom);
+ if (technology == SC_TECHNOLOGY_DEFAULT) {
+ AutoSurface surfaceWindow(pps->hdc, this);
+ if (surfaceWindow) {
+ rcPaint = PRectangle(pps->rcPaint.left, pps->rcPaint.top, pps->rcPaint.right, pps->rcPaint.bottom);
+ PRectangle rcClient = GetClientRectangle();
+ paintingAllText = rcPaint.Contains(rcClient);
+ Paint(surfaceWindow, rcPaint);
+ surfaceWindow->Release();
+ }
+ } else {
+ EnsureRenderTarget();
+ AutoSurface surfaceWindow(pRenderTarget, this);
+ if (surfaceWindow) {
+ pRenderTarget->BeginDraw();
+ rcPaint = PRectangle(pps->rcPaint.left, pps->rcPaint.top, pps->rcPaint.right, pps->rcPaint.bottom);
+ PRectangle rcClient = GetClientRectangle();
+ paintingAllText = rcPaint.Contains(rcClient);
+ if (paintingAllText) {
+ //Platform::DebugPrintf("Performing full text paint\n");
+ } else {
+ //Platform::DebugPrintf("Performing partial paint %d .. %d\n", rcPaint.top, rcPaint.bottom);
+ }
+ Paint(surfaceWindow, rcPaint);
+ surfaceWindow->Release();
+ HRESULT hr = pRenderTarget->EndDraw();
+ if (hr == D2DERR_RECREATE_TARGET) {
+ DropRenderTarget();
+ }
}
- Paint(surfaceWindow, rcPaint);
- surfaceWindow->Release();
- HRESULT hr = pRenderTarget->EndDraw();
- if (hr == D2DERR_RECREATE_TARGET) {
- DropRenderTarget();
- }
}
if (hRgnUpdate) {
::DeleteRgn(hRgnUpdate);
@@ -1131,6 +1139,11 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
case SCI_SETTECHNOLOGY:
if ((wParam == SC_TECHNOLOGY_DEFAULT) || (wParam == SC_TECHNOLOGY_DIRECTWRITE)) {
if (technology != static_cast<int>(wParam)) {
+ if (static_cast<int>(wParam) == SC_TECHNOLOGY_DIRECTWRITE) {
+ if (!LoadD2D())
+ // Failed to load Direct2D or DirectWrite so no effect
+ return 0;
+ }
technology = wParam;
// Invalidate all cached information including layout.
InvalidateStyleRedraw();