summaryrefslogtreecommitdiff
path: root/platform/default/headless_view.cpp
diff options
context:
space:
mode:
authorLeith Bade <leith@mapbox.com>2014-12-03 22:02:55 +1100
committerLeith Bade <leith@mapbox.com>2014-12-03 22:02:55 +1100
commit94d34ce7ac7182a1ff7cc0dea675abcdd7592b56 (patch)
treee5f23d9ec5ff189873928ee6ef9e2d5ea3f7dee0 /platform/default/headless_view.cpp
parentf090d6b2642a4b28f9690c4724a2f702d82f4072 (diff)
parent82f3574d09064a442e30eb2dc7639f473749c5bd (diff)
downloadqtlocation-mapboxgl-94d34ce7ac7182a1ff7cc0dea675abcdd7592b56.tar.gz
Merge branch 'master' of github.com:mapbox/mapbox-gl-native into android-mason
Conflicts: src/map/map.cpp
Diffstat (limited to 'platform/default/headless_view.cpp')
-rw-r--r--platform/default/headless_view.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/platform/default/headless_view.cpp b/platform/default/headless_view.cpp
index c23ddadd6b..2f74b9c763 100644
--- a/platform/default/headless_view.cpp
+++ b/platform/default/headless_view.cpp
@@ -1,6 +1,8 @@
#include <mbgl/platform/default/headless_view.hpp>
#include <mbgl/platform/default/headless_display.hpp>
+#include <mbgl/util/std.hpp>
+
#include <stdexcept>
#include <sstream>
#include <string>
@@ -253,14 +255,14 @@ std::unique_ptr<uint32_t[]> HeadlessView::readPixels() {
const unsigned int w = width_ * pixelRatio_;
const unsigned int h = height_ * pixelRatio_;
- auto pixels = std::unique_ptr<uint32_t[]>(new uint32_t[w * h]);
+ auto pixels = util::make_unique<uint32_t[]>(w * h);
make_active();
glReadPixels(0, 0, width_, height_, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get());
make_inactive();
const int stride = w * 4;
- auto tmp = std::unique_ptr<char[]>(new char[stride]());
+ auto tmp = util::make_unique<char[]>(stride);
char *rgba = reinterpret_cast<char *>(pixels.get());
for (int i = 0, j = height_ - 1; i < j; i++, j--) {
std::memcpy(tmp.get(), rgba + i * stride, stride);