summaryrefslogtreecommitdiff
path: root/platform/default/headless_view.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-12-03 11:27:24 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-12-03 11:27:24 +0100
commit82f3574d09064a442e30eb2dc7639f473749c5bd (patch)
treedfb0aa6182a0d7d04b6131199d67ff90a87cb9c1 /platform/default/headless_view.cpp
parent50669307c5648e62941a63e0c75dba8602448d9d (diff)
downloadqtlocation-mapboxgl-82f3574d09064a442e30eb2dc7639f473749c5bd.tar.gz
add array overloads to make_unique and move it to mbgl::util from std
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 10d6ed8f42..5b95c76026 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>
@@ -232,14 +234,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);