richedit: Clip painting to formatting rectangle

Dylan Smith dylan.ah.smith at gmail.com
Sun Jan 11 01:59:53 CST 2009


---
 dlls/riched20/paint.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
-------------- next part --------------
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index f0acf4a..4071a99 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -29,6 +29,13 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *
   ME_Context c;
   int yoffset;
   int ys, ye;
+  HRGN oldRgn, clipRgn;
+
+  oldRgn = CreateRectRgn(0, 0, 0, 0);
+  GetClipRgn(hDC, oldRgn);
+  clipRgn = CreateRectRgn(rcUpdate->left, rcUpdate->top,
+                          rcUpdate->right, rcUpdate->bottom);
+  SelectClipRgn(hDC, clipRgn);
 
   editor->nSequence++;
   yoffset = ME_GetYScrollPos(editor);
@@ -105,6 +112,10 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *
     ME_SendRequestResize(editor, FALSE);
   editor->nLastTotalLength = editor->nTotalLength;
   ME_DestroyContext(&c, NULL);
+
+  SelectClipRgn(hDC, oldRgn);
+  DeleteObject(clipRgn);
+  DeleteObject(oldRgn);
 }
 
 void ME_Repaint(ME_TextEditor *editor)
@@ -1050,7 +1061,8 @@ void ME_Scroll(ME_TextEditor *editor, int value, int type)
   if (abs(nActualScroll) > editor->sizeWindow.cy)
     InvalidateRect(editor->hWnd, NULL, TRUE);
   else
-    ScrollWindowEx(editor->hWnd, 0, nActualScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE);
+    ScrollWindowEx(editor->hWnd, 0, nActualScroll, &editor->rcFormat,
+                   &editor->rcFormat, NULL, NULL, SW_INVALIDATE);
   ME_Repaint(editor);
   
   hWnd = editor->hWnd;


More information about the wine-patches mailing list