https://git.reactos.org/?p=reactos.git;a=commitdiff;h=68e6820ddf3ddf5d19c7d89c14964ad7f5635c95

commit 68e6820ddf3ddf5d19c7d89c14964ad7f5635c95
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Wed Mar 22 08:10:26 2023 +0900
Commit:     Katayama Hirofumi MZ <[email protected]>
CommitDate: Wed Mar 22 08:10:26 2023 +0900

    [MSPAINT] Improve CMiniatureWindow::OnPaint
    
    CORE-18867
---
 base/applications/mspaint/miniature.cpp | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/base/applications/mspaint/miniature.cpp 
b/base/applications/mspaint/miniature.cpp
index 6df83aee49a..b9efd889a81 100644
--- a/base/applications/mspaint/miniature.cpp
+++ b/base/applications/mspaint/miniature.cpp
@@ -22,12 +22,14 @@ LRESULT CMiniatureWindow::OnClose(UINT nMsg, WPARAM wParam, 
LPARAM lParam, BOOL&
 
 LRESULT CMiniatureWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, 
BOOL& bHandled)
 {
-    DefWindowProc(WM_PAINT, wParam, lParam);
-    RECT mclient;
-    HDC hdc;
-    miniature.GetClientRect(&mclient);
-    hdc = miniature.GetDC();
-    StretchBlt(hdc, 0, 0, mclient.right, mclient.bottom, imageModel.GetDC(), 
0, 0, imageModel.GetWidth(), imageModel.GetHeight(), SRCCOPY);
-    miniature.ReleaseDC(hdc);
+    RECT rc;
+    GetClientRect(&rc);
+
+    PAINTSTRUCT ps;
+    HDC hDC = BeginPaint(&ps);
+    StretchBlt(hDC, 0, 0, rc.right, rc.bottom,
+               imageModel.GetDC(), 0, 0, imageModel.GetWidth(), 
imageModel.GetHeight(),
+               SRCCOPY);
+    EndPaint(&ps);
     return 0;
 }

Reply via email to