summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2018-07-19 14:30:53 -0400
committerJason Wray <jason@mapbox.com>2018-07-19 14:30:53 -0400
commit43547f25a5b324b3c60b6f7f26b9c92722c32502 (patch)
tree939abe3c562e701032cd65f56146bd8ddc3c244f
parent826f35d290f57f82be81c20472bbd2dfc6bbfe6c (diff)
downloadqtlocation-mapboxgl-upstream/fb-geometry-externs.tar.gz
[ios] Simplify and (internally) document MGLPointRounded()upstream/fb-geometry-externs
`UIScreen.nativeScale` is available beginning in iOS 8, so the conditional is no longer necessay.
-rw-r--r--platform/darwin/src/MGLGeometry.mm2
-rw-r--r--platform/darwin/src/MGLGeometry_Private.h3
2 files changed, 4 insertions, 1 deletions
diff --git a/platform/darwin/src/MGLGeometry.mm b/platform/darwin/src/MGLGeometry.mm
index 44d1c0749b..c6fb5a5fc2 100644
--- a/platform/darwin/src/MGLGeometry.mm
+++ b/platform/darwin/src/MGLGeometry.mm
@@ -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
diff --git a/platform/darwin/src/MGLGeometry_Private.h b/platform/darwin/src/MGLGeometry_Private.h
index e48ed19d78..4ea3dfe6e3 100644
--- a/platform/darwin/src/MGLGeometry_Private.h
+++ b/platform/darwin/src/MGLGeometry_Private.h
@@ -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);