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