[MSPAINT]
authorRafal Harabien <rafalh@reactos.org>
Sat, 25 Jun 2011 14:34:52 +0000 (14:34 +0000)
committerRafal Harabien <rafalh@reactos.org>
Sat, 25 Jun 2011 14:34:52 +0000 (14:34 +0000)
- Fix MSVC warnings

svn path=/trunk/; revision=52455

reactos/base/applications/mspaint/drawing.c
reactos/base/applications/mspaint/drawing.h
reactos/base/applications/mspaint/globalvar.h
reactos/base/applications/mspaint/main.c
reactos/base/applications/mspaint/mouse.c
reactos/base/applications/mspaint/mouse.h
reactos/base/applications/mspaint/winproc.c

index bafbe1c..e87b9bf 100644 (file)
@@ -13,7 +13,7 @@
 /* FUNCTIONS ********************************************************/
 
 void
-Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness)
+Line(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, int thickness)
 {
     HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, color));
     MoveToEx(hdc, x1, y1, NULL);
@@ -22,7 +22,7 @@ Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness)
 }
 
 void
-Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style)
+Rect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg,  COLORREF bg, int thickness, int style)
 {
     HBRUSH oldBrush;
     LOGBRUSH logbrush;
@@ -37,7 +37,7 @@ Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickn
 }
 
 void
-Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style)
+Ellp(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg,  COLORREF bg, int thickness, int style)
 {
     HBRUSH oldBrush;
     LOGBRUSH logbrush;
@@ -52,7 +52,7 @@ Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickn
 }
 
 void
-RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style)
+RRect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg,  COLORREF bg, int thickness, int style)
 {
     LOGBRUSH logbrush;
     HBRUSH oldBrush;
@@ -67,7 +67,7 @@ RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thick
 }
 
 void
-Poly(HDC hdc, POINT * lpPoints, int nCount, int fg, int bg, int thickness, int style, BOOL closed)
+Poly(HDC hdc, POINT * lpPoints, int nCount,  COLORREF fg,  COLORREF bg, int thickness, int style, BOOL closed)
 {
     LOGBRUSH logbrush;
     HBRUSH oldBrush;
@@ -85,7 +85,7 @@ Poly(HDC hdc, POINT * lpPoints, int nCount, int fg, int bg, int thickness, int s
 }
 
 void
-Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness)
+Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, COLORREF color, int thickness)
 {
     HPEN oldPen;
     POINT fourPoints[4];
@@ -99,7 +99,7 @@ Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness
 }
 
 void
-Fill(HDC hdc, int x, int y, int color)
+Fill(HDC hdc, LONG x, LONG y, COLORREF color)
 {
     HBRUSH oldBrush = SelectObject(hdc, CreateSolidBrush(color));
     ExtFloodFill(hdc, x, y, GetPixel(hdc, x, y), FLOODFILLSURFACE);
@@ -107,7 +107,7 @@ Fill(HDC hdc, int x, int y, int color)
 }
 
 void
-Erase(HDC hdc, short x1, short y1, short x2, short y2, int color, int radius)
+Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
 {
     short a;
     HPEN oldPen;
@@ -122,9 +122,10 @@ Erase(HDC hdc, short x1, short y1, short x2, short y2, int color, int radius)
 }
 
 void
-Replace(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int radius)
+Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LONG radius)
 {
-    short a, x, y;
+    LONG a, x, y;
+    
     for(a = 0; a <= 100; a++)
         for(y = (y1 * (100 - a) + y2 * a) / 100 - radius + 1;
             y < (y1 * (100 - a) + y2 * a) / 100 + radius + 1; y++)
@@ -135,10 +136,10 @@ Replace(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int rad
 }
 
 void
-Airbrush(HDC hdc, short x, short y, int color, int r)
+Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
 {
-    short a;
-    short b;
+    LONG a, b;
+    
     for(b = -r; b <= r; b++)
         for(a = -r; a <= r; a++)
             if ((a * a + b * b <= r * r) && (rand() % 4 == 0))
@@ -146,7 +147,7 @@ Airbrush(HDC hdc, short x, short y, int color, int r)
 }
 
 void
-Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style)
+Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, COLORREF style)
 {
     HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 1, color));
     HBRUSH oldBrush = SelectObject(hdc, CreateSolidBrush(color));
@@ -231,7 +232,7 @@ Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style)
 }
 
 void
-RectSel(HDC hdc, short x1, short y1, short x2, short y2)
+RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
 {
     HBRUSH oldBrush;
     LOGBRUSH logbrush;
@@ -246,7 +247,7 @@ RectSel(HDC hdc, short x1, short y1, short x2, short y2)
 }
 
 void
-SelectionFrame(HDC hdc, int x1, int y1, int x2, int y2)
+SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
 {
     HBRUSH oldBrush;
     LOGBRUSH logbrush;
index db0d050..b9f23ad 100644 (file)
@@ -6,28 +6,28 @@
  * PROGRAMMERS: Benedikt Freisen
  */
 
-void Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness);
+void Line(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, int thickness);
 
-void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style);
+void Rect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style);
 
-void Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style);
+void Ellp(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style);
 
-void RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style);
+void RRect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style);
 
-void Poly(HDC hdc, POINT *lpPoints, int nCount, int fg, int bg, int thickness, int style, BOOL closed);
+void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed);
 
-void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness);
+void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, COLORREF color, int thickness);
 
-void Fill(HDC hdc, int x, int y, int color);
+void Fill(HDC hdc, LONG x, LONG y, COLORREF color);
 
-void Erase(HDC hdc, short x1, short y1, short x2, short y2, int color, int radius);
+void Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius);
 
-void Replace(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int radius);
+void Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LONG radius);
 
-void Airbrush(HDC hdc, short x, short y, int color, int r);
+void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r);
 
-void Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style);
+void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, int style);
 
-void RectSel(HDC hdc, short x1, short y1, short x2, short y2);
+void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2);
 
-void SelectionFrame(HDC hdc, int x1, int y1, int x2, int y2);
+void SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2);
index 9c884e4..d716dd9 100644 (file)
@@ -26,10 +26,10 @@ extern int undoSteps;
 extern int redoSteps;
 extern BOOL imageSaved;
 
-extern short startX;
-extern short startY;
-extern short lastX;
-extern short lastY;
+extern LONG startX;
+extern LONG startY;
+extern LONG lastX;
+extern LONG lastY;
 extern int lineWidth;
 extern int shapeStyle;
 extern int brushStyle;
index af84d5b..a103af9 100644 (file)
@@ -43,10 +43,10 @@ int undoSteps = 0;
 int redoSteps = 0;
 BOOL imageSaved = TRUE;
 
-short startX;
-short startY;
-short lastX;
-short lastY;
+LONG startX;
+LONG startY;
+LONG lastX;
+LONG lastY;
 int lineWidth = 1;
 int shapeStyle = 0;
 int brushStyle = 0;
index 0cda187..26d3ffb 100644 (file)
@@ -26,7 +26,7 @@ placeSelWin()
 }
 
 void
-regularize(short x0, short y0, short *x1, short *y1)
+regularize(LONG x0, LONG y0, LONG *x1, LONG *y1)
 {
     if (abs(*x1 - x0) >= abs(*y1 - y0))
         *y1 = y0 + (*y1 > y0 ? abs(*x1 - x0) : -abs(*x1 - x0));
@@ -35,7 +35,7 @@ regularize(short x0, short y0, short *x1, short *y1)
 }
 
 void
-roundTo8Directions(short x0, short y0, short *x1, short *y1)
+roundTo8Directions(LONG x0, LONG y0, LONG *x1, LONG *y1)
 {
     if (abs(*x1 - x0) >= abs(*y1 - y0))
     {
@@ -59,7 +59,7 @@ POINT *ptStack = NULL;
 int ptSP = 0;
 
 void
-startPaintingL(HDC hdc, short x, short y, int fg, int bg)
+startPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
 {
     startX = x;
     startY = y;
@@ -132,7 +132,7 @@ startPaintingL(HDC hdc, short x, short y, int fg, int bg)
 }
 
 void
-whilePaintingL(HDC hdc, short x, short y, int fg, int bg)
+whilePaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
 {
     switch (activeTool)
     {
@@ -149,8 +149,8 @@ whilePaintingL(HDC hdc, short x, short y, int fg, int bg)
             break;
         case TOOL_RECTSEL:
         {
-            short tempX;
-            short tempY;
+            int tempX;
+            int tempY;
             resetToU1();
             tempX = max(0, min(x, imgXRes));
             tempY = max(0, min(y, imgYRes));
@@ -209,7 +209,7 @@ whilePaintingL(HDC hdc, short x, short y, int fg, int bg)
             pointStack[pointSP].y = y;
             if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
                 roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y,
-                                   (short *)&pointStack[pointSP].x, (short *)&pointStack[pointSP].y);
+                                   &pointStack[pointSP].x, &pointStack[pointSP].y);
             if (pointSP + 1 >= 2)
                 Poly(hdc, pointStack, pointSP + 1, fg, bg, lineWidth, shapeStyle, FALSE);
             break;
@@ -232,7 +232,7 @@ whilePaintingL(HDC hdc, short x, short y, int fg, int bg)
 }
 
 void
-endPaintingL(HDC hdc, short x, short y, int fg, int bg)
+endPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
 {
     switch (activeTool)
     {
@@ -350,7 +350,7 @@ endPaintingL(HDC hdc, short x, short y, int fg, int bg)
             pointStack[pointSP].y = y;
             if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
                 roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y,
-                                   (short *)&pointStack[pointSP].x, (short *)&pointStack[pointSP].y);
+                                   &pointStack[pointSP].x, &pointStack[pointSP].y);
             pointSP++;
             if (pointSP >= 2)
             {
@@ -384,7 +384,7 @@ endPaintingL(HDC hdc, short x, short y, int fg, int bg)
 }
 
 void
-startPaintingR(HDC hdc, short x, short y, int fg, int bg)
+startPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
 {
     startX = x;
     startY = y;
@@ -444,7 +444,7 @@ startPaintingR(HDC hdc, short x, short y, int fg, int bg)
 }
 
 void
-whilePaintingR(HDC hdc, short x, short y, int fg, int bg)
+whilePaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
 {
     switch (activeTool)
     {
@@ -496,7 +496,7 @@ whilePaintingR(HDC hdc, short x, short y, int fg, int bg)
             pointStack[pointSP].y = y;
             if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
                 roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y,
-                                   (short *)&pointStack[pointSP].x, (short *)&pointStack[pointSP].y);
+                                   &pointStack[pointSP].x, &pointStack[pointSP].y);
             if (pointSP + 1 >= 2)
                 Poly(hdc, pointStack, pointSP + 1, bg, fg, lineWidth, shapeStyle, FALSE);
             break;
@@ -519,7 +519,7 @@ whilePaintingR(HDC hdc, short x, short y, int fg, int bg)
 }
 
 void
-endPaintingR(HDC hdc, short x, short y, int fg, int bg)
+endPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
 {
     switch (activeTool)
     {
@@ -553,7 +553,7 @@ endPaintingR(HDC hdc, short x, short y, int fg, int bg)
             pointStack[pointSP].y = y;
             if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
                 roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y,
-                                   (short *)&pointStack[pointSP].x, (short *)&pointStack[pointSP].y);
+                                   &pointStack[pointSP].x, &pointStack[pointSP].y);
             pointSP++;
             if (pointSP >= 2)
             {
index acb083c..ea56ba8 100644 (file)
@@ -8,14 +8,14 @@
 
 void placeSelWin(void);
 
-void startPaintingL(HDC hdc, short x, short y, int fg, int bg);
+void startPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg);
 
-void whilePaintingL(HDC hdc, short x, short y, int fg, int bg);
+void whilePaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg);
 
-void endPaintingL(HDC hdc, short x, short y, int fg, int bg);
+void endPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg);
 
-void startPaintingR(HDC hdc, short x, short y, int fg, int bg);
+void startPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg);
 
-void whilePaintingR(HDC hdc, short x, short y, int fg, int bg);
+void whilePaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg);
 
-void endPaintingR(HDC hdc, short x, short y, int fg, int bg);
+void endPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg);
index 2e45069..ef8aed7 100644 (file)
@@ -503,7 +503,7 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                 }
                 SendMessage(hImageArea, WM_PAINT, 0, 0);
                 if ((activeTool == TOOL_ZOOM) && (zoom < 8000))
-                    zoomTo(zoom * 2, (short)LOWORD(lParam), (short)HIWORD(lParam));
+                    zoomTo(zoom * 2, LOWORD(lParam), HIWORD(lParam));
             }
             break;
 
@@ -524,7 +524,7 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                 }
                 SendMessage(hImageArea, WM_PAINT, 0, 0);
                 if ((activeTool == TOOL_ZOOM) && (zoom > 125))
-                    zoomTo(zoom / 2, (short)LOWORD(lParam), (short)HIWORD(lParam));
+                    zoomTo(zoom / 2, LOWORD(lParam), HIWORD(lParam));
             }
             break;
 
@@ -589,8 +589,8 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         case WM_MOUSEMOVE:
             if (hwnd == hImageArea)
             {
-                short xNow = (short)LOWORD(lParam) * 1000 / zoom;
-                short yNow = (short)HIWORD(lParam) * 1000 / zoom;
+                LONG xNow = LOWORD(lParam) * 1000 / zoom;
+                LONG yNow = HIWORD(lParam) * 1000 / zoom;
                 if ((!drawing) || (activeTool <= TOOL_AIRBRUSH))
                 {
                     TRACKMOUSEEVENT tme;
@@ -598,7 +598,7 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                     if (activeTool == TOOL_ZOOM)
                     {
                         SendMessage(hImageArea, WM_PAINT, 0, 0);
-                        drawZoomFrame((short)LOWORD(lParam), (short)HIWORD(lParam));
+                        drawZoomFrame(LOWORD(lParam), HIWORD(lParam));
                     }
 
                     tme.cbSize = sizeof(TRACKMOUSEEVENT);
@@ -617,8 +617,8 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                 if (drawing)
                 {
                     /* values displayed in statusbar */
-                    short xRel = xNow - startX;
-                    short yRel = yNow - startY;
+                    LONG xRel = xNow - startX;
+                    LONG yRel = yNow - startY;
                     /* freesel, rectsel and text tools always show numbers limited to fit into image area */
                     if ((activeTool == TOOL_FREESEL) || (activeTool == TOOL_RECTSEL) || (activeTool == TOOL_TEXT))
                     {