diff options
Diffstat (limited to 'CyteKit/extern.h')
-rw-r--r-- | CyteKit/extern.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/CyteKit/extern.h b/CyteKit/extern.h index 670f560..562fb26 100644 --- a/CyteKit/extern.h +++ b/CyteKit/extern.h @@ -35,4 +35,24 @@ bool CyteIsReachable(const char *name); void CyteInitialize(NSString *app, NSString *version); +static inline double Retina(double value) { + value *= ScreenScale_; + value = round(value); + value /= ScreenScale_; + return value; +} + +static inline CGRect Retina(CGRect value) { + value.origin.x *= ScreenScale_; + value.origin.y *= ScreenScale_; + value.size.width *= ScreenScale_; + value.size.height *= ScreenScale_; + value = CGRectIntegral(value); + value.origin.x /= ScreenScale_; + value.origin.y /= ScreenScale_; + value.size.width /= ScreenScale_; + value.size.height /= ScreenScale_; + return value; +} + #endif//CyteKit_extern_H |