mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 02:25:40 +00:00
[MSPAINT]
- fix incorrect image resizing -- patch by Katayama Hirofumi MZ CORE-10719 #resolve svn path=/trunk/; revision=74936
This commit is contained in:
parent
7ca0d5807c
commit
9a2dd59876
3 changed files with 18 additions and 5 deletions
|
@ -129,6 +129,11 @@ void ImageModel::Crop(int nWidth, int nHeight, int nOffsetX, int nOffsetY)
|
||||||
int oldWidth = GetWidth();
|
int oldWidth = GetWidth();
|
||||||
int oldHeight = GetHeight();
|
int oldHeight = GetHeight();
|
||||||
|
|
||||||
|
if (nWidth <= 0)
|
||||||
|
nWidth = 1;
|
||||||
|
if (nHeight <= 0)
|
||||||
|
nHeight = 1;
|
||||||
|
|
||||||
SelectObject(hDrawingDC, hBms[currInd]);
|
SelectObject(hDrawingDC, hBms[currInd]);
|
||||||
DeleteObject(hBms[(currInd + 1) % HISTORYSIZE]);
|
DeleteObject(hBms[(currInd + 1) % HISTORYSIZE]);
|
||||||
hBms[(currInd + 1) % HISTORYSIZE] = CreateDIBWithProperties(nWidth, nHeight);
|
hBms[(currInd + 1) % HISTORYSIZE] = CreateDIBWithProperties(nWidth, nHeight);
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
/* FUNCTIONS ********************************************************/
|
/* FUNCTIONS ********************************************************/
|
||||||
|
|
||||||
BOOL resizing = FALSE;
|
static BOOL resizing = FALSE;
|
||||||
short xOrig;
|
static short xOrig;
|
||||||
short yOrig;
|
static short yOrig;
|
||||||
|
|
||||||
LRESULT CSizeboxWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT CSizeboxWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
|
@ -76,8 +76,6 @@ LRESULT CSizeboxWindow::OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||||
{
|
{
|
||||||
short xRel;
|
short xRel;
|
||||||
short yRel;
|
short yRel;
|
||||||
ReleaseCapture();
|
|
||||||
resizing = FALSE;
|
|
||||||
int imgXRes = imageModel.GetWidth();
|
int imgXRes = imageModel.GetWidth();
|
||||||
int imgYRes = imageModel.GetHeight();
|
int imgYRes = imageModel.GetHeight();
|
||||||
xRel = (GET_X_LPARAM(lParam) - xOrig) * 1000 / toolsModel.GetZoom();
|
xRel = (GET_X_LPARAM(lParam) - xOrig) * 1000 / toolsModel.GetZoom();
|
||||||
|
@ -100,5 +98,13 @@ LRESULT CSizeboxWindow::OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||||
imageModel.Crop(imgXRes + xRel, imgYRes + yRel, 0, 0);
|
imageModel.Crop(imgXRes + xRel, imgYRes + yRel, 0, 0);
|
||||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) _T(""));
|
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) _T(""));
|
||||||
}
|
}
|
||||||
|
ReleaseCapture();
|
||||||
|
resizing = FALSE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CSizeboxWindow::OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
|
{
|
||||||
|
resizing = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,12 @@ public:
|
||||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
|
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
|
||||||
MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
|
MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
|
||||||
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
|
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
|
||||||
|
MESSAGE_HANDLER(WM_CANCELMODE, OnCancelMode)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
LRESULT OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
LRESULT OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
LRESULT OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
LRESULT OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
LRESULT OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
LRESULT OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
|
LRESULT OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue