From 5c52401d5504ab4b84d1510042c6b97504c50933 Mon Sep 17 00:00:00 2001 From: Asheem Mamoowala Date: Tue, 2 May 2017 09:54:06 -0700 Subject: [core] Make Map.addImage tests pass (#8843) Fix Node tests suite implementation to parse pixelRatio from style json Premultiply images in the node binding before sending to mbgl core --- include/mbgl/util/image.hpp | 5 ++++- include/mbgl/util/premultiply.hpp | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 include/mbgl/util/premultiply.hpp (limited to 'include/mbgl') diff --git a/include/mbgl/util/image.hpp b/include/mbgl/util/image.hpp index c019bb949c..a41b8462bd 100644 --- a/include/mbgl/util/image.hpp +++ b/include/mbgl/util/image.hpp @@ -40,11 +40,14 @@ public: Image(Image&& o) : size(o.size), - data(std::move(o.data)) {} + data(std::move(o.data)) { + o.size.width = o.size.height = 0; + } Image& operator=(Image&& o) { size = o.size; data = std::move(o.data); + o.size.width = o.size.height = 0; return *this; } diff --git a/include/mbgl/util/premultiply.hpp b/include/mbgl/util/premultiply.hpp new file mode 100644 index 0000000000..532c7cb11d --- /dev/null +++ b/include/mbgl/util/premultiply.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include + +namespace mbgl { +namespace util { + +PremultipliedImage premultiply(UnassociatedImage&&); +UnassociatedImage unpremultiply(PremultipliedImage&&); + +} // namespace util +} // namespace mbgl -- cgit v1.2.1