Skip to content

Instantly share code, notes, and snippets.

@danielctull
Forked from steipete/PSPDFGeometry.m
Last active August 29, 2015 14:07
Show Gist options
  • Save danielctull/7ef1f9d9d65754316ae3 to your computer and use it in GitHub Desktop.
Save danielctull/7ef1f9d9d65754316ae3 to your computer and use it in GitHub Desktop.
CGRect PSPDFRectSafeInset(CGRect rect, CGFloat dx, CGFloat dy) {
CGRect insetRect = CGRectInset(rect, dx, dy);
if (CGRectIsNull(insetRect)) {
insetRect = CGRectMake(CGRectGetMidX(rect), CGRectGetMidY(rect), 0.f, 0.f);
}
return insetRect;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment