[MSPAINT] Trivial improvements

- Use SetPixelV instead of SetPixel.
- BI_RGB is zero.
- Use CS_HREDRAW and CS_VREDRAW.
CORE-18867
This commit is contained in:
Katayama Hirofumi MZ 2023-06-14 17:42:21 +09:00
parent 3b4422b41b
commit 318b2e786d
6 changed files with 6 additions and 13 deletions

View file

@ -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);
}

View file

@ -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++)

View file

@ -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

View file

@ -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);
};

View file

@ -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)

View file

@ -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);
}
};