Author: bfreisen
Date: Wed Jun  7 10:00:04 2017
New Revision: 74936

URL: http://svn.reactos.org/svn/reactos?rev=74936&view=rev
Log:
[MSPAINT]
- fix incorrect image resizing -- patch by Katayama Hirofumi MZ

CORE-10719 #resolve

Modified:
    trunk/reactos/base/applications/mspaint/history.cpp
    trunk/reactos/base/applications/mspaint/sizebox.cpp
    trunk/reactos/base/applications/mspaint/sizebox.h

Modified: trunk/reactos/base/applications/mspaint/history.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/history.cpp?rev=74936&r1=74935&r2=74936&view=diff
==============================================================================
--- trunk/reactos/base/applications/mspaint/history.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/history.cpp [iso-8859-1] Wed Jun  7 
10:00:04 2017
@@ -129,6 +129,11 @@
     int oldWidth = GetWidth();
     int oldHeight = GetHeight();
 
+    if (nWidth <= 0)
+        nWidth = 1;
+    if (nHeight <= 0)
+        nHeight = 1;
+
     SelectObject(hDrawingDC, hBms[currInd]);
     DeleteObject(hBms[(currInd + 1) % HISTORYSIZE]);
     hBms[(currInd + 1) % HISTORYSIZE] = CreateDIBWithProperties(nWidth, 
nHeight);

Modified: trunk/reactos/base/applications/mspaint/sizebox.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/sizebox.cpp?rev=74936&r1=74935&r2=74936&view=diff
==============================================================================
--- trunk/reactos/base/applications/mspaint/sizebox.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/sizebox.cpp [iso-8859-1] Wed Jun  7 
10:00:04 2017
@@ -12,9 +12,9 @@
 
 /* FUNCTIONS ********************************************************/
 
-BOOL resizing = FALSE;
-short xOrig;
-short yOrig;
+static BOOL resizing = FALSE;
+static short xOrig;
+static short yOrig;
 
 LRESULT CSizeboxWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, 
BOOL& bHandled)
 {
@@ -76,8 +76,6 @@
     {
         short xRel;
         short yRel;
-        ReleaseCapture();
-        resizing = FALSE;
         int imgXRes = imageModel.GetWidth();
         int imgYRes = imageModel.GetHeight();
         xRel = (GET_X_LPARAM(lParam) - xOrig) * 1000 / toolsModel.GetZoom();
@@ -100,5 +98,13 @@
             imageModel.Crop(imgXRes + xRel, imgYRes + yRel, 0, 0);
         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;
+}

Modified: trunk/reactos/base/applications/mspaint/sizebox.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/sizebox.h?rev=74936&r1=74935&r2=74936&view=diff
==============================================================================
--- trunk/reactos/base/applications/mspaint/sizebox.h   [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/sizebox.h   [iso-8859-1] Wed Jun  7 
10:00:04 2017
@@ -16,10 +16,12 @@
         MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
         MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
         MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
+        MESSAGE_HANDLER(WM_CANCELMODE, OnCancelMode)
     END_MSG_MAP()
 
     LRESULT OnSetCursor(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 OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& 
bHandled);
+    LRESULT OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& 
bHandled);
 };


Reply via email to