aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32
diff options
context:
space:
mode:
authornyamatongwe <unknown>2005-11-15 12:24:02 +0000
committernyamatongwe <unknown>2005-11-15 12:24:02 +0000
commitb4e2719fa215ec1f2ed4fd1ab57977096538adc4 (patch)
tree62b697f7bdd0aca303c3fc4175b2f1e79704eb00 /win32
parent66168dadd629eb12f72169d95c98686a3b456fa5 (diff)
downloadscintilla-mirror-b4e2719fa215ec1f2ed4fd1ab57977096538adc4.tar.gz
Check whether area is being painted against the update region,
not just the bounding box of this region. This ensures that a need to abandon a paint when a restyle affects text outside the area being painted.
Diffstat (limited to 'win32')
-rw-r--r--win32/ScintillaWin.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index a4c09a0fb..c7f569970 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -147,6 +147,8 @@ class ScintillaWin :
unsigned int linesPerScroll; ///< Intellimouse support
int wheelDelta; ///< Wheel delta from roll
+ HRGN hRgnUpdate;
+
bool hasOKText;
CLIPFORMAT cfColumnSelect;
@@ -183,6 +185,7 @@ class ScintillaWin :
virtual void SetTicking(bool on);
virtual void SetMouseCapture(bool on);
virtual bool HaveMouseCapture();
+ virtual bool PaintContains(PRectangle rc);
virtual void ScrollText(int linesToMove);
virtual void UpdateSystemCaret();
virtual void SetVerticalScrollPos();
@@ -277,6 +280,8 @@ ScintillaWin::ScintillaWin(HWND hwnd) {
linesPerScroll = 0;
wheelDelta = 0; // Wheel delta from roll
+ hRgnUpdate = 0;
+
hasOKText = false;
// There does not seem to be a real standard for indicating that the clipboard
@@ -409,9 +414,12 @@ LRESULT ScintillaWin::WndPaint(uptr_t wParam) {
bool IsOcxCtrl = (wParam != 0); // if wParam != 0, it contains
// a PAINSTRUCT* from the OCX
+ PLATFORM_ASSERT(hRgnUpdate == NULL);
+ hRgnUpdate = ::CreateRectRgn(0, 0, 0, 0);
if (IsOcxCtrl) {
pps = reinterpret_cast<PAINTSTRUCT*>(wParam);
} else {
+ ::GetUpdateRgn(MainHWND(), hRgnUpdate, FALSE);
pps = &ps;
::BeginPaint(MainHWND(), pps);
}
@@ -428,6 +436,11 @@ LRESULT ScintillaWin::WndPaint(uptr_t wParam) {
Paint(surfaceWindow, rcPaint);
surfaceWindow->Release();
}
+ if (hRgnUpdate) {
+ ::DeleteRgn(hRgnUpdate);
+ hRgnUpdate = 0;
+ }
+
if(!IsOcxCtrl)
::EndPaint(MainHWND(), pps);
if (paintState == paintAbandoned) {
@@ -989,6 +1002,30 @@ bool ScintillaWin::HaveMouseCapture() {
//return capturedMouse && (::GetCapture() == MainHWND());
}
+bool ScintillaWin::PaintContains(PRectangle rc) {
+ bool contains = true;
+ if (paintState == painting) {
+ if (!rcPaint.Contains(rc)) {
+ contains = false;
+ } else {
+ // In bounding rectangle so check more accurately using region
+ HRGN hRgnRange = ::CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
+ if (hRgnRange) {
+ HRGN hRgnDest = ::CreateRectRgn(0, 0, 0, 0);
+ if (hRgnDest) {
+ int combination = ::CombineRgn(hRgnDest, hRgnRange, hRgnUpdate, RGN_DIFF);
+ if (combination != NULLREGION) {
+ contains = false;
+ }
+ ::DeleteRgn(hRgnDest);
+ }
+ ::DeleteRgn(hRgnRange);
+ }
+ }
+ }
+ return contains;
+}
+
void ScintillaWin::ScrollText(int linesToMove) {
//Platform::DebugPrintf("ScintillaWin::ScrollText %d\n", linesToMove);
::ScrollWindow(MainHWND(), 0,