summaryrefslogtreecommitdiff
path: root/src/mbgl/geometry/line_atlas.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-05-11 11:28:11 +0200
committerKonstantin Käfer <mail@kkaefer.com>2015-05-11 11:28:11 +0200
commitb7b532ce28e2f7571697fb53aa33f33b7a16bd5a (patch)
tree969aa5cff09737a90962d3fa25c08e10aee318cd /src/mbgl/geometry/line_atlas.cpp
parent04c73e5ae13a1cc223e3be817d1c4220457aff25 (diff)
downloadqtlocation-mapboxgl-b7b532ce28e2f7571697fb53aa33f33b7a16bd5a.tar.gz
manage atlas textures with unique_ptrs
Diffstat (limited to 'src/mbgl/geometry/line_atlas.cpp')
-rw-r--r--src/mbgl/geometry/line_atlas.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/mbgl/geometry/line_atlas.cpp b/src/mbgl/geometry/line_atlas.cpp
index a0bdbc0e57..91ac15639b 100644
--- a/src/mbgl/geometry/line_atlas.cpp
+++ b/src/mbgl/geometry/line_atlas.cpp
@@ -3,6 +3,7 @@
#include <mbgl/platform/gl.hpp>
#include <mbgl/platform/log.hpp>
#include <mbgl/platform/platform.hpp>
+#include <mbgl/util/std.hpp>
#include <boost/functional/hash.hpp>
@@ -14,7 +15,7 @@ using namespace mbgl;
LineAtlas::LineAtlas(uint16_t w, uint16_t h)
: width(w),
height(h),
- data(new uint8_t[w * h]),
+ data(util::make_unique<uint8_t[]>(w * h)),
dirty(true) {
}
@@ -23,8 +24,6 @@ LineAtlas::~LineAtlas() {
Environment::Get().abandonTexture(texture);
texture = 0;
-
- delete[] data;
}
LinePatternPos LineAtlas::getDashPosition(const std::vector<float> &dasharray, bool round) {
@@ -162,7 +161,7 @@ void LineAtlas::bind() {
0, // GLint border
GL_ALPHA, // GLenum format
GL_UNSIGNED_BYTE, // GLenum type
- data // const GLvoid * data
+ data.get() // const GLvoid * data
));
} else {
MBGL_CHECK_ERROR(glTexSubImage2D(
@@ -174,7 +173,7 @@ void LineAtlas::bind() {
height, // GLsizei height
GL_ALPHA, // GLenum format
GL_UNSIGNED_BYTE, // GLenum type
- data // const GLvoid *pixels
+ data.get() // const GLvoid *pixels
));
}