https://git.reactos.org/?p=reactos.git;a=commitdiff;h=58c26d3fe6317e32b37cc…
commit 58c26d3fe6317e32b37cc2ce49997f48b3f15da0
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Nov 23 14:22:40 2023 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Thu Nov 23 14:22:40 2023 +0900
[MSPAINT] Simplify CanvasToImage
Refactoring. CORE-19094
---
base/applications/mspaint/canvas.cpp | 13 ++++---------
base/applications/mspaint/canvas.h | 4 ++--
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/base/applications/mspaint/canvas.cpp b/base/applications/mspaint/canvas.cpp
index 99be275fd02..4509fbceee4 100644
--- a/base/applications/mspaint/canvas.cpp
+++ b/base/applications/mspaint/canvas.cpp
@@ -51,20 +51,16 @@ VOID CCanvasWindow::ImageToCanvas(RECT& rc)
::OffsetRect(&rc, GRIP_SIZE - GetScrollPos(SB_HORZ), GRIP_SIZE -
GetScrollPos(SB_VERT));
}
-VOID CCanvasWindow::CanvasToImage(POINT& pt, BOOL bZoomed)
+VOID CCanvasWindow::CanvasToImage(POINT& pt)
{
pt.x -= GRIP_SIZE - GetScrollPos(SB_HORZ);
pt.y -= GRIP_SIZE - GetScrollPos(SB_VERT);
- if (bZoomed)
- return;
UnZoomed(pt);
}
-VOID CCanvasWindow::CanvasToImage(RECT& rc, BOOL bZoomed)
+VOID CCanvasWindow::CanvasToImage(RECT& rc)
{
::OffsetRect(&rc, GetScrollPos(SB_HORZ) - GRIP_SIZE, GetScrollPos(SB_VERT) -
GRIP_SIZE);
- if (bZoomed)
- return;
UnZoomed(rc);
}
@@ -367,12 +363,11 @@ LRESULT CCanvasWindow::OnButtonDown(UINT nMsg, WPARAM wParam, LPARAM
lParam, BOO
return 0;
}
- CanvasToImage(pt, TRUE);
+ CanvasToImage(pt);
if (hit == HIT_INNER)
{
m_drawing = TRUE;
- UnZoomed(pt);
SetCapture();
toolsModel.OnButtonDown(bLeftButton, pt.x, pt.y, FALSE);
Invalidate(FALSE);
@@ -382,10 +377,10 @@ LRESULT CCanvasWindow::OnButtonDown(UINT nMsg, WPARAM wParam, LPARAM
lParam, BOO
if (bLeftButton)
{
m_hitCanvasSizeBox = hit;
- UnZoomed(pt);
m_ptOrig = pt;
SetCapture();
}
+
return 0;
}
diff --git a/base/applications/mspaint/canvas.h b/base/applications/mspaint/canvas.h
index d65be1df606..9c780028cb2 100644
--- a/base/applications/mspaint/canvas.h
+++ b/base/applications/mspaint/canvas.h
@@ -49,8 +49,8 @@ public:
VOID ImageToCanvas(POINT& pt);
VOID ImageToCanvas(RECT& rc);
- VOID CanvasToImage(POINT& pt, BOOL bZoomed = FALSE);
- VOID CanvasToImage(RECT& rc, BOOL bZoomed = FALSE);
+ VOID CanvasToImage(POINT& pt);
+ VOID CanvasToImage(RECT& rc);
VOID GetImageRect(RECT& rc);
VOID MoveSelection(INT xDelta, INT yDelta);
VOID getNewZoomRect(CRect& rcView, INT newZoom, CPoint ptTarget);