[MSPAINT] s/Bound/Clamp/

CORE-18867
This commit is contained in:
Katayama Hirofumi MZ 2023-06-22 07:57:36 +09:00
parent ec53d42278
commit d04e049284
3 changed files with 7 additions and 7 deletions

View file

@ -254,7 +254,7 @@ void ImageModel::RotateNTimes90Degrees(int iN)
NotifyImageChanged(); NotifyImageChanged();
} }
void ImageModel::Bound(POINT& pt) const void ImageModel::Clamp(POINT& pt) const
{ {
pt.x = max(0, min(pt.x, GetWidth())); pt.x = max(0, min(pt.x, GetWidth()));
pt.y = max(0, min(pt.y, GetHeight())); pt.y = max(0, min(pt.y, GetHeight()));

View file

@ -36,7 +36,7 @@ public:
void FlipHorizontally(); void FlipHorizontally();
void FlipVertically(); void FlipVertically();
void RotateNTimes90Degrees(int iN); void RotateNTimes90Degrees(int iN);
void Bound(POINT& pt) const; void Clamp(POINT& pt) const;
void NotifyImageChanged(); void NotifyImageChanged();
protected: protected:

View file

@ -159,7 +159,7 @@ struct FreeSelTool : ToolBase
if (bLeftButton) if (bLeftButton)
{ {
POINT pt = { x, y }; POINT pt = { x, y };
imageModel.Bound(pt); imageModel.Clamp(pt);
selectionModel.PushToPtStack(pt); selectionModel.PushToPtStack(pt);
imageModel.NotifyImageChanged(); imageModel.NotifyImageChanged();
} }
@ -247,7 +247,7 @@ struct RectSelTool : ToolBase
if (bLeftButton) if (bLeftButton)
{ {
POINT pt = { x, y }; POINT pt = { x, y };
imageModel.Bound(pt); imageModel.Clamp(pt);
selectionModel.SetRectFromPoints(g_ptStart, pt); selectionModel.SetRectFromPoints(g_ptStart, pt);
imageModel.NotifyImageChanged(); imageModel.NotifyImageChanged();
} }
@ -258,7 +258,7 @@ struct RectSelTool : ToolBase
POINT pt = { x, y }; POINT pt = { x, y };
if (bLeftButton) if (bLeftButton)
{ {
imageModel.Bound(pt); imageModel.Clamp(pt);
selectionModel.SetRectFromPoints(g_ptStart, pt); selectionModel.SetRectFromPoints(g_ptStart, pt);
selectionModel.m_bShow = !selectionModel.m_rc.IsRectEmpty(); selectionModel.m_bShow = !selectionModel.m_rc.IsRectEmpty();
imageModel.NotifyImageChanged(); imageModel.NotifyImageChanged();
@ -528,7 +528,7 @@ struct TextTool : ToolBase
void UpdatePoint(LONG x, LONG y) void UpdatePoint(LONG x, LONG y)
{ {
POINT pt = { x, y }; POINT pt = { x, y };
imageModel.Bound(pt); imageModel.Clamp(pt);
selectionModel.SetRectFromPoints(g_ptStart, pt); selectionModel.SetRectFromPoints(g_ptStart, pt);
imageModel.NotifyImageChanged(); imageModel.NotifyImageChanged();
} }
@ -572,7 +572,7 @@ struct TextTool : ToolBase
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
{ {
POINT pt = { x, y }; POINT pt = { x, y };
imageModel.Bound(pt); imageModel.Clamp(pt);
selectionModel.SetRectFromPoints(g_ptStart, pt); selectionModel.SetRectFromPoints(g_ptStart, pt);
BOOL bTextBoxShown = ::IsWindowVisible(textEditWindow); BOOL bTextBoxShown = ::IsWindowVisible(textEditWindow);