diff --git a/include/mapnik/image.hpp b/include/mapnik/image.hpp index bea771449..7165e0c61 100644 --- a/include/mapnik/image.hpp +++ b/include/mapnik/image.hpp @@ -38,22 +38,16 @@ struct MAPNIK_DECL buffer buffer(buffer && rhs) noexcept; buffer(buffer const& rhs); ~buffer(); - buffer& operator=(buffer rhs); - inline bool operator!() const - { - return (data_ == nullptr)? true : false; - } - - void swap(buffer & rhs); - unsigned char* data(); - unsigned char const* data() const; - std::size_t size() const; + inline bool operator!() const {return (data_ == nullptr)? true : false;} + inline unsigned char* data() {return data_;} + inline unsigned char const* data() const {return data_;} + inline std::size_t size() const {return size_;} private: + void swap(buffer & rhs); std::size_t size_; unsigned char* data_; bool owns_; - }; template @@ -97,7 +91,7 @@ public: bool painted = false); image(int width, int height, - detail::buffer && buf, + unsigned char* data, bool premultiplied = false, bool painted = false); image(image const& rhs); diff --git a/include/mapnik/image_impl.hpp b/include/mapnik/image_impl.hpp index 94b753c1c..2be52933f 100644 --- a/include/mapnik/image_impl.hpp +++ b/include/mapnik/image_impl.hpp @@ -78,9 +78,9 @@ image::image() {} template -image::image(int width, int height, detail::buffer && buf, bool premultiplied, bool painted) +image::image(int width, int height, unsigned char* data, bool premultiplied, bool painted) : dimensions_(width, height), - buffer_(std::move(buf)), + buffer_(data, width * height * sizeof(pixel_size)), pData_(reinterpret_cast(buffer_.data())), offset_(0.0), scaling_(1.0), diff --git a/src/image.cpp b/src/image.cpp index 006ce3191..df2001276 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -82,21 +82,6 @@ void buffer::swap(buffer & rhs) std::swap(owns_, rhs.owns_); } -unsigned char* buffer::data() -{ - return data_; -} - -unsigned char const* buffer::data() const -{ - return data_; -} - -std::size_t buffer::size() const -{ - return size_; -} - template struct MAPNIK_DECL image_dimensions<65535>; } // end ns detail