From b7b532ce28e2f7571697fb53aa33f33b7a16bd5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 11 May 2015 11:28:11 +0200 Subject: manage atlas textures with unique_ptrs --- src/mbgl/geometry/line_atlas.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/mbgl/geometry/line_atlas.cpp') 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 #include #include +#include #include @@ -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(w * h)), dirty(true) { } @@ -23,8 +24,6 @@ LineAtlas::~LineAtlas() { Environment::Get().abandonTexture(texture); texture = 0; - - delete[] data; } LinePatternPos LineAtlas::getDashPosition(const std::vector &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 )); } -- cgit v1.2.1