Skip to content

Instantly share code, notes, and snippets.

@bsingr
Created February 12, 2014 15:54
Show Gist options
  • Save bsingr/8958131 to your computer and use it in GitHub Desktop.
Save bsingr/8958131 to your computer and use it in GitHub Desktop.
Drawing on non-retina devices.
// https://developer.apple.com/library/ios/documentation/2ddrawing/conceptual/drawingprintingios/graphicsdrawingoverview/graphicsdrawingoverview.html
#define ALIGN_POINT_TO_PIXEL(floatValue) ( (((NSInteger) roundf(floatValue)) % 2 == 0) ? floatValue : floatValue + 0.5f )
// Usage:
// rect.x = ALIGN_POINT_TO_PIXEL(rect.x)