https://git.reactos.org/?p=reactos.git;a=commitdiff;h=318b2e786dbd8c1409264…
commit 318b2e786dbd8c14092640a68179c37853568150
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Jun 14 17:42:21 2023 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Wed Jun 14 17:42:21 2023 +0900
[MSPAINT] Trivial improvements
- Use SetPixelV instead of SetPixel.
- BI_RGB is zero.
- Use CS_HREDRAW and CS_VREDRAW.
CORE-18867
---
base/applications/mspaint/dib.cpp | 1 -
base/applications/mspaint/drawing.cpp | 2 +-
base/applications/mspaint/fullscreen.cpp | 6 ------
base/applications/mspaint/fullscreen.h | 5 ++---
base/applications/mspaint/miniature.h | 3 ++-
base/applications/mspaint/mouse.cpp | 2 +-
6 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/base/applications/mspaint/dib.cpp b/base/applications/mspaint/dib.cpp
index 51d09d86d6b..3d74403cdda 100644
--- a/base/applications/mspaint/dib.cpp
+++ b/base/applications/mspaint/dib.cpp
@@ -33,7 +33,6 @@ CreateDIBWithProperties(int width, int height)
bmi.bmiHeader.biHeight = height;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 24;
- bmi.bmiHeader.biCompression = BI_RGB;
return CreateDIBSection(NULL, &bmi, DIB_RGB_COLORS, NULL, NULL, 0);
}
diff --git a/base/applications/mspaint/drawing.cpp
b/base/applications/mspaint/drawing.cpp
index 600e7addd7a..7bb0d57da60 100644
--- a/base/applications/mspaint/drawing.cpp
+++ b/base/applications/mspaint/drawing.cpp
@@ -189,7 +189,7 @@ Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color,
LONG style)
case 2:
MoveToEx(hdc, x1, y1, NULL);
LineTo(hdc, x2, y2);
- SetPixel(hdc, x2, y2, color);
+ ::SetPixelV(hdc, x2, y2, color);
break;
case 3:
for(a = 0; a <= b; a++)
diff --git a/base/applications/mspaint/fullscreen.cpp
b/base/applications/mspaint/fullscreen.cpp
index 610062c0dbc..63dd070da6d 100644
--- a/base/applications/mspaint/fullscreen.cpp
+++ b/base/applications/mspaint/fullscreen.cpp
@@ -50,12 +50,6 @@ LRESULT CFullscreenWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM
lParam, BOOL
return 0;
}
-LRESULT CFullscreenWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
bHandled)
-{
- Invalidate(TRUE);
- return 0;
-}
-
LRESULT CFullscreenWindow::OnGetText(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
bHandled)
{
// return caption of the main window, instead
diff --git a/base/applications/mspaint/fullscreen.h
b/base/applications/mspaint/fullscreen.h
index 4466b116266..5afe843700e 100644
--- a/base/applications/mspaint/fullscreen.h
+++ b/base/applications/mspaint/fullscreen.h
@@ -11,7 +11,8 @@
class CFullscreenWindow : public CWindowImpl<CFullscreenWindow>
{
public:
- DECLARE_WND_CLASS_EX(_T("FullscreenWindow"), CS_DBLCLKS, COLOR_BACKGROUND)
+ DECLARE_WND_CLASS_EX(_T("FullscreenWindow"), CS_DBLCLKS | CS_HREDRAW |
CS_VREDRAW,
+ COLOR_BACKGROUND)
BEGIN_MSG_MAP(CFullscreenWindow)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
@@ -19,7 +20,6 @@ public:
MESSAGE_HANDLER(WM_KEYDOWN, OnCloseOrKeyDownOrLButtonDown)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnCloseOrKeyDownOrLButtonDown)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
- MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_GETTEXT, OnGetText)
END_MSG_MAP()
@@ -29,6 +29,5 @@ private:
LRESULT OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnCloseOrKeyDownOrLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam,
BOOL& bHandled);
LRESULT OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
- LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnGetText(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
};
diff --git a/base/applications/mspaint/miniature.h
b/base/applications/mspaint/miniature.h
index b68d03a086f..63f0fd6997a 100644
--- a/base/applications/mspaint/miniature.h
+++ b/base/applications/mspaint/miniature.h
@@ -12,7 +12,8 @@
class CMiniatureWindow : public CWindowImpl<CMiniatureWindow>
{
public:
- DECLARE_WND_CLASS_EX(_T("MiniatureWindow"), CS_DBLCLKS, COLOR_BTNFACE)
+ DECLARE_WND_CLASS_EX(_T("MiniatureWindow"), CS_DBLCLKS | CS_HREDRAW |
CS_VREDRAW,
+ COLOR_BTNFACE)
BEGIN_MSG_MAP(CMiniatureWindow)
MESSAGE_HANDLER(WM_CLOSE, OnClose)
diff --git a/base/applications/mspaint/mouse.cpp b/base/applications/mspaint/mouse.cpp
index bd7d23c139c..61395e8aa7f 100644
--- a/base/applications/mspaint/mouse.cpp
+++ b/base/applications/mspaint/mouse.cpp
@@ -366,7 +366,7 @@ struct PenTool : GenericDrawTool
{
COLORREF rgb = bLeftButton ? m_fg : m_bg;
Line(m_hdc, last.x, last.y, x, y, rgb, 1);
- SetPixel(m_hdc, x, y, rgb);
+ ::SetPixelV(m_hdc, x, y, rgb);
}
};