X64 transport [Part 5] (Update plugins.cpp)
[xy_vsfilter.git] / src / subpic / CRect2.h
blob871d26fe24ef0e5ca4b02cd639d2fd019f655149
1 #pragma once
3 #include <atltypes.h>
4 #include <cmath>
6 #define SIGN_OF(x) ((x)>0?1:(x)=0?0:-1)
7 #define DISTANCE(x1,y1,x2,y2) (abs(x1-x2)+abs(y1-y2))
9 class CRect2: public CRect
11 public:
12 inline static int Compare(LPCRECT lpRect1, LPCRECT lpRect2)
14 int dLeft = lpRect1->left - lpRect2->left;
15 if(dLeft!=0)
16 return dLeft;
17 else
19 int dTop = lpRect1->top - lpRect2->top;
20 return dTop;
23 inline static bool IsIntersect(LPCRECT lpRect1, LPCRECT lpRect2)
25 CRect r;
26 return ::IntersectRect(r, lpRect1, lpRect2) == TRUE;
28 inline static int Area(LPCRECT lpRect)
30 return (lpRect->right-lpRect->left)*(lpRect->bottom-lpRect->top);
34 class CPoint2: public CPoint
36 public:
37 inline static int Distance(POINT p1, POINT p2)
39 return abs(p1.x - p2.x) + abs(p1.y - p2.y);
41 inline static int Distance(int x1, int y1, int x2, int y2)
43 return abs(x1-x2) + abs(y1-y2);