[ios] Simplify and (internally) document MGLPointRounded()

`UIScreen.nativeScale` is available beginning in iOS 8, so the conditional is no longer necessary.
This commit is contained in:
Jason Wray
2018-07-19 14:30:53 -04:00
parent 08b08878d3
commit 14dc94e65f
2 changed files with 4 additions and 1 deletions

View File

@@ -98,7 +98,7 @@ CLLocationDirection MGLDirectionBetweenCoordinates(CLLocationCoordinate2D firstC
CGPoint MGLPointRounded(CGPoint point) {
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
CGFloat scaleFactor = [UIScreen instancesRespondToSelector:@selector(nativeScale)] ? [UIScreen mainScreen].nativeScale : [UIScreen mainScreen].scale;
CGFloat scaleFactor = [UIScreen mainScreen].nativeScale;
#elif TARGET_OS_MAC
CGFloat scaleFactor = [NSScreen mainScreen].backingScaleFactor;
#endif

View File

@@ -138,6 +138,9 @@ MGLRadianCoordinate2D MGLRadianCoordinateAtDistanceFacingDirection(MGLRadianCoor
*/
CLLocationDirection MGLDirectionBetweenCoordinates(CLLocationCoordinate2D firstCoordinate, CLLocationCoordinate2D secondCoordinate);
/**
Returns a point with coordinates rounded to the nearest logical pixel.
*/
CGPoint MGLPointRounded(CGPoint point);
MGLMatrix4 MGLMatrix4Make(std::array<double, 16> mat);