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:
parent
5fa7402a36
commit
50cd5b6a57
|
@ -47,7 +47,9 @@
|
|||
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue