summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/platform/default/headless_view.hpp2
-rw-r--r--include/mbgl/util/image.hpp14
-rw-r--r--include/mbgl/util/token.hpp2
3 files changed, 8 insertions, 10 deletions
diff --git a/include/mbgl/platform/default/headless_view.hpp b/include/mbgl/platform/default/headless_view.hpp
index c0baddb884..f140338349 100644
--- a/include/mbgl/platform/default/headless_view.hpp
+++ b/include/mbgl/platform/default/headless_view.hpp
@@ -27,7 +27,7 @@ public:
void createContext();
void resize(uint16_t width, uint16_t height, float pixelRatio);
- const std::unique_ptr<uint32_t[]> readPixels();
+ std::unique_ptr<uint32_t[]> readPixels();
void notify();
void notify_map_change(MapChange change, timestamp delay = 0);
diff --git a/include/mbgl/util/image.hpp b/include/mbgl/util/image.hpp
index dc8f6a8150..b2f70e1442 100644
--- a/include/mbgl/util/image.hpp
+++ b/include/mbgl/util/image.hpp
@@ -2,31 +2,29 @@
#define MBGL_UTIL_IMAGE
#include <string>
-#include <cstring>
-#include <stdexcept>
+#include <memory>
namespace mbgl {
namespace util {
-std::string compress_png(int width, int height, void *rgba, bool flip = false);
+std::string compress_png(int width, int height, void *rgba);
class Image {
public:
- Image(const std::string &img, bool flip = false);
- ~Image();
+ Image(const std::string &img);
- inline const char *getData() const { return img; }
+ inline const char *getData() const { return img.get(); }
inline uint32_t getWidth() const { return width; }
inline uint32_t getHeight() const { return height; }
+ inline operator bool() const { return img && width && height; }
private:
// loaded image dimensions
uint32_t width = 0, height = 0;
// the raw image data
- char *img = nullptr;
-
+ std::unique_ptr<char[]> img;
};
diff --git a/include/mbgl/util/token.hpp b/include/mbgl/util/token.hpp
index 0f045f434a..64192a99f9 100644
--- a/include/mbgl/util/token.hpp
+++ b/include/mbgl/util/token.hpp
@@ -22,7 +22,7 @@ std::string replaceTokens(const std::string &source, const Lookup &lookup) {
result.append(pos, brace);
pos = brace;
if (pos != end) {
- for (brace++; brace != end && std::isalnum(*brace); brace++);
+ for (brace++; brace != end && (std::isalnum(*brace) || *brace == '_'); brace++);
if (brace != end && *brace == '}') {
result.append(lookup({ pos + 1, brace }));
pos = brace + 1;