winemac: Fix conversion of empty RECT to an empty CGRect.

For some empty RECTs, such as { INT_MAX, INT_MAX, INT_MIN, INT_MIN }, right
minus left or bottom minus top underflow and wrap around to positive values.
This commit is contained in:
Ken Thomases 2015-01-19 13:11:15 -06:00 committed by Alexandre Julliard
parent 5fa7402a36
commit 50cd5b6a57
1 changed files with 3 additions and 1 deletions

View File

@ -47,7 +47,9 @@
static inline CGRect cgrect_from_rect(RECT rect) static inline CGRect cgrect_from_rect(RECT rect)
{ {
return CGRectMake(rect.left, rect.top, max(0, rect.right - rect.left), max(0, rect.bottom - rect.top)); if (rect.left >= rect.right || rect.top >= rect.bottom)
return CGRectMake(rect.left, rect.top, 0, 0);
return CGRectMake(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
} }
static inline RECT rect_from_cgrect(CGRect cgrect) static inline RECT rect_from_cgrect(CGRect cgrect)