mirror of
https://github.com/reactos/reactos.git
synced 2024-06-17 01:51:49 +00:00
parent
30e47fdb77
commit
ce54a8a5f2
|
@ -13,6 +13,7 @@
|
|||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
BOOL zoomTo(int newZoom, int mouseX, int mouseY);
|
||||
BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1);
|
||||
|
||||
static inline int Zoomed(int xy)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* FILE: base/applications/mspaint/mouse.cpp
|
||||
* PURPOSE: Things which should not be in the mouse event handler itself
|
||||
* PROGRAMMERS: Benedikt Freisen
|
||||
* Katayama Hirofumi MZ
|
||||
*/
|
||||
|
||||
/* INCLUDES *********************************************************/
|
||||
|
@ -50,6 +51,13 @@ roundTo8Directions(LONG x0, LONG y0, LONG& x1, LONG& y1)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1)
|
||||
{
|
||||
INT cxThreshold = toolsModel.GetLineWidth() + UnZoomed(GetSystemMetrics(SM_CXDRAG));
|
||||
INT cyThreshold = toolsModel.GetLineWidth() + UnZoomed(GetSystemMetrics(SM_CYDRAG));
|
||||
return (abs(x1 - x0) <= cxThreshold) && (abs(y1 - y0) <= cyThreshold);
|
||||
}
|
||||
|
||||
POINT pointStack[256];
|
||||
short pointSP;
|
||||
|
||||
|
@ -297,8 +305,7 @@ endPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
|
|||
pointSP++;
|
||||
if (pointSP >= 2)
|
||||
{
|
||||
if ((pointStack[0].x - x) * (pointStack[0].x - x) +
|
||||
(pointStack[0].y - y) * (pointStack[0].y - y) <= toolsModel.GetLineWidth() * toolsModel.GetLineWidth() + 1)
|
||||
if (nearlyEqualPoints(x, y, pointStack[0].x, pointStack[0].y))
|
||||
{
|
||||
Poly(hdc, pointStack, pointSP, fg, bg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle(), TRUE, FALSE);
|
||||
pointSP = 0;
|
||||
|
@ -500,8 +507,7 @@ endPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
|
|||
pointSP++;
|
||||
if (pointSP >= 2)
|
||||
{
|
||||
if ((pointStack[0].x - x) * (pointStack[0].x - x) +
|
||||
(pointStack[0].y - y) * (pointStack[0].y - y) <= toolsModel.GetLineWidth() * toolsModel.GetLineWidth() + 1)
|
||||
if (nearlyEqualPoints(x, y, pointStack[0].x, pointStack[0].y))
|
||||
{
|
||||
Poly(hdc, pointStack, pointSP, bg, fg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle(), TRUE, FALSE);
|
||||
pointSP = 0;
|
||||
|
|
Loading…
Reference in a new issue