Skip to content

Instantly share code, notes, and snippets.

@hunterbridges
Created February 23, 2014 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hunterbridges/9168343 to your computer and use it in GitHub Desktop.
Save hunterbridges/9168343 to your computer and use it in GitHub Desktop.
static inline CGRect CGRectBoundingRect(CGRect a, CGRect b) {
CGRect ret = {
.origin = {
MIN(CGRectGetMinX(a), CGRectGetMinX(b)),
MIN(CGRectGetMinY(a), CGRectGetMinY(b))
},
.size = {
MAX(CGRectGetMaxX(a), CGRectGetMaxX(b)) -
MIN(CGRectGetMinX(a), CGRectGetMinX(b)),
MAX(CGRectGetMaxY(a), CGRectGetMaxY(b)) -
MIN(CGRectGetMinY(a), CGRectGetMinY(b))
}
};
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment