diff options
author | Jason Wray <friedbunny@users.noreply.github.com> | 2018-04-16 19:17:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-16 19:17:37 -0400 |
commit | 3d3b87e020b727d38c56d0c9aa357cf8d4f14951 (patch) | |
tree | 9cbcad2fd736e65b6f7ee2f202329eba19ed6dd5 /platform/darwin/src/MGLGeometry.mm | |
parent | d4e597eb94a90a816fcc480fa7b6719430a20b84 (diff) | |
download | qtlocation-mapboxgl-3d3b87e020b727d38c56d0c9aa357cf8d4f14951.tar.gz |
[ios] Fix type narrowing issue with MGLOpenGLStyleLayer projection matrix (#11664)
`CATransform3D`'s matrix is internally typed as `CGFloat`, which we were implicitly casting to from `double`.... except that the `-Wc++11-narrowing` flag disallows implicit narrowing casts and we need `double` precision, anyway.
* [ios, macos] Use MGLMatrix4 a 4x4 double matrix for MGLOpenGLStyleLayer projection matrix.
* [ios, macos] Don't use union for MGLMatrix4
Diffstat (limited to 'platform/darwin/src/MGLGeometry.mm')
-rw-r--r-- | platform/darwin/src/MGLGeometry.mm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLGeometry.mm b/platform/darwin/src/MGLGeometry.mm index 0b044f7521..6785779570 100644 --- a/platform/darwin/src/MGLGeometry.mm +++ b/platform/darwin/src/MGLGeometry.mm @@ -111,3 +111,14 @@ MGLMapPoint MGLMapPointForCoordinate(CLLocationCoordinate2D coordinate, double z mbgl::Point<double> projectedCoordinate = mbgl::Projection::project(MGLLatLngFromLocationCoordinate2D(coordinate), std::pow(2.0, zoomLevel)); return MGLMapPointMake(projectedCoordinate.x, projectedCoordinate.y, zoomLevel); } + +MGLMatrix4 MGLMatrix4Make(std::array<double, 16> array) { + MGLMatrix4 mat4 = { + .m00 = array[0], .m01 = array[1], .m02 = array[2], .m03 = array[3], + .m10 = array[4], .m11 = array[5], .m12 = array[6], .m13 = array[7], + .m20 = array[8], .m21 = array[9], .m22 = array[10], .m23 = array[11], + .m30 = array[12], .m31 = array[13], .m32 = array[14], .m33 = array[15] + }; + return mat4; +} + |