wine/dlls/riched20 paint.c editstr.h editor.c

Alexandre Julliard julliard at wine.codeweavers.com
Thu Nov 3 05:33:24 CST 2005


ChangeSet ID:	21079
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/03 05:33:24

Modified files:
	dlls/riched20  : paint.c editstr.h editor.c 

Log message:
	Phil Krylov <phil at newstar.rinet.ru>
	Cache background color brush instead of recreating it at each screen
	update.

Patch: http://cvs.winehq.org/patch.py?id=21079

Old revision  New revision  Changes     Path
 1.15          1.16          +1 -4       wine/dlls/riched20/paint.c
 1.16          1.17          +1 -0       wine/dlls/riched20/editstr.h
 1.66          1.67          +12 -5      wine/dlls/riched20/editor.c

Index: wine/dlls/riched20/paint.c
diff -u -p wine/dlls/riched20/paint.c:1.15 wine/dlls/riched20/paint.c:1.16
--- wine/dlls/riched20/paint.c:1.15	3 Nov 2005 11:33:24 -0000
+++ wine/dlls/riched20/paint.c	3 Nov 2005 11:33:24 -0000
@@ -78,14 +78,11 @@ void ME_PaintContent(ME_TextEditor *edit
     }
 
     if (ye>ys) {
-      HBRUSH hbr;
-      hbr = CreateSolidBrush(ME_GetBackColor(c.editor));
       rc.left = xs;
       rc.top = ys;
       rc.right = xe;
       rc.bottom = ye;
-      FillRect(hDC, &rc, hbr);
-      DeleteObject(hbr);
+      FillRect(hDC, &rc, c.editor->hbrBackground);
     }
     if (ys == c.pt.y) /* don't overwrite the top bar */
       ys++;
Index: wine/dlls/riched20/editstr.h
diff -u -p wine/dlls/riched20/editstr.h:1.16 wine/dlls/riched20/editstr.h:1.17
--- wine/dlls/riched20/editstr.h:1.16	3 Nov 2005 11:33:24 -0000
+++ wine/dlls/riched20/editstr.h	3 Nov 2005 11:33:24 -0000
@@ -270,6 +270,7 @@ typedef struct tagME_TextEditor
   int nSequence;
   int nOldSelFrom, nOldSelTo;
   COLORREF rgbBackColor;
+  HBRUSH hbrBackground;
   BOOL bCaretAtEnd;
   int nEventMask;
   int nModifyStep;
Index: wine/dlls/riched20/editor.c
diff -u -p wine/dlls/riched20/editor.c:1.66 wine/dlls/riched20/editor.c:1.67
--- wine/dlls/riched20/editor.c:1.66	3 Nov 2005 11:33:24 -0000
+++ wine/dlls/riched20/editor.c	3 Nov 2005 11:33:24 -0000
@@ -821,6 +821,7 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd) 
   ed->nUDArrowX = -1;
   ed->nSequence = 0;
   ed->rgbBackColor = -1;
+  ed->hbrBackground = GetSysColorBrush(COLOR_WINDOW);
   ed->bCaretAtEnd = FALSE;
   ed->nEventMask = 0;
   ed->nModifyStep = 0;
@@ -926,7 +927,8 @@ void ME_DestroyEditor(ME_TextEditor *edi
     if (editor->pFontCache[i].hFont)
       DeleteObject(editor->pFontCache[i].hFont);
   }
-    
+  DeleteObject(editor->hbrBackground);
+
   FREE_OBJ(editor);
 }
 
@@ -1265,10 +1267,18 @@ LRESULT WINAPI RichEditANSIWndProc(HWND 
   case EM_SETBKGNDCOLOR:
   {
     LRESULT lColor = ME_GetBackColor(editor);
+    if (editor->rgbBackColor != -1)
+      DeleteObject(editor->hbrBackground);
     if (wParam)
+    {
       editor->rgbBackColor = -1;
+      editor->hbrBackground = GetSysColorBrush(COLOR_WINDOW);
+    }
     else
+    {
       editor->rgbBackColor = lParam;
+      editor->hbrBackground = CreateSolidBrush(editor->rgbBackColor);
+    }
     if (editor->bRedraw)
     {
       InvalidateRect(hWnd, NULL, TRUE);
@@ -1792,12 +1802,9 @@ LRESULT WINAPI RichEditANSIWndProc(HWND 
     {
       HDC hDC = (HDC)wParam;
       RECT rc;
-      COLORREF rgbBG = ME_GetBackColor(editor);
       if (GetUpdateRect(hWnd,&rc,TRUE))
       {
-        HBRUSH hbr = CreateSolidBrush(rgbBG);
-        FillRect(hDC, &rc, hbr);
-        DeleteObject(hbr);
+        FillRect(hDC, &rc, editor->hbrBackground);
       }
     }
     return 1;



More information about the wine-cvs mailing list