gdi32: Add a helper function to order the points of a rectangle.
This commit is contained in:
parent
ff5d68ccb2
commit
456b4c876e
|
@ -108,18 +108,7 @@ static RECT get_device_rect( HDC hdc, int left, int top, int right, int bottom,
|
|||
rect.right--;
|
||||
}
|
||||
LPtoDP( hdc, (POINT *)&rect, 2 );
|
||||
if (rect.left > rect.right)
|
||||
{
|
||||
int tmp = rect.left;
|
||||
rect.left = rect.right;
|
||||
rect.right = tmp;
|
||||
}
|
||||
if (rect.top > rect.bottom)
|
||||
{
|
||||
int tmp = rect.top;
|
||||
rect.top = rect.bottom;
|
||||
rect.bottom = tmp;
|
||||
}
|
||||
order_rect( &rect );
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
|
|
@ -2181,9 +2181,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
|
|||
}
|
||||
|
||||
LPtoDP(hdc, (POINT*)&rc, 2);
|
||||
|
||||
if(rc.left > rc.right) {INT tmp = rc.left; rc.left = rc.right; rc.right = tmp;}
|
||||
if(rc.top > rc.bottom) {INT tmp = rc.top; rc.top = rc.bottom; rc.bottom = tmp;}
|
||||
order_rect( &rc );
|
||||
}
|
||||
|
||||
if (lprect && (flags & ETO_OPAQUE))
|
||||
|
|
|
@ -439,6 +439,22 @@ static inline void offset_rect( RECT *rect, int offset_x, int offset_y )
|
|||
rect->bottom += offset_y;
|
||||
}
|
||||
|
||||
static inline void order_rect( RECT *rect )
|
||||
{
|
||||
if (rect->left > rect->right)
|
||||
{
|
||||
int tmp = rect->left;
|
||||
rect->left = rect->right;
|
||||
rect->right = tmp;
|
||||
}
|
||||
if (rect->top > rect->bottom)
|
||||
{
|
||||
int tmp = rect->top;
|
||||
rect->top = rect->bottom;
|
||||
rect->bottom = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void get_bounding_rect( RECT *rect, int x, int y, int width, int height )
|
||||
{
|
||||
rect->left = x;
|
||||
|
|
|
@ -1114,20 +1114,8 @@ BOOL WINAPI RectInRegion( HRGN hrgn, const RECT *rect )
|
|||
|
||||
/* swap the coordinates to make right >= left and bottom >= top */
|
||||
/* (region building rectangles are normalized the same way) */
|
||||
if( rect->top > rect->bottom) {
|
||||
rc.top = rect->bottom;
|
||||
rc.bottom = rect->top;
|
||||
} else {
|
||||
rc.top = rect->top;
|
||||
rc.bottom = rect->bottom;
|
||||
}
|
||||
if( rect->right < rect->left) {
|
||||
rc.right = rect->left;
|
||||
rc.left = rect->right;
|
||||
} else {
|
||||
rc.right = rect->right;
|
||||
rc.left = rect->left;
|
||||
}
|
||||
rc = *rect;
|
||||
order_rect( &rc );
|
||||
|
||||
if ((obj = GDI_GetObjPtr( hrgn, OBJ_REGION )))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue