diff --git a/include/mapnik/image_view.hpp b/include/mapnik/image_view.hpp index f9d13977f..eb4eac6e7 100644 --- a/include/mapnik/image_view.hpp +++ b/include/mapnik/image_view.hpp @@ -35,12 +35,14 @@ public: using pixel_type = typename T::pixel_type; static const image_dtype dtype = T::dtype; static constexpr std::size_t pixel_size = sizeof(pixel_type); - + image_view() = delete; image_view(unsigned x, unsigned y, unsigned width, unsigned height, T const& data); ~image_view(); - + image_view(image_view const& rhs); image_view & operator=(image_view const& rhs); + bool operator==(image_view const& rhs) const; + bool operator<(image_view const& rhs) const; unsigned x() const; unsigned y() const; diff --git a/include/mapnik/image_view_any.hpp b/include/mapnik/image_view_any.hpp index 7281d8550..3381f90c1 100644 --- a/include/mapnik/image_view_any.hpp +++ b/include/mapnik/image_view_any.hpp @@ -42,7 +42,7 @@ using image_view_base = util::variant image_view_any(T && data) noexcept diff --git a/include/mapnik/image_view_impl.hpp b/include/mapnik/image_view_impl.hpp index 7c46ab63f..e71176d90 100644 --- a/include/mapnik/image_view_impl.hpp +++ b/include/mapnik/image_view_impl.hpp @@ -62,6 +62,18 @@ image_view & image_view::operator=(image_view const& rhs) return *this; } +template +bool image_view::operator==(image_view const& rhs) const +{ + return rhs.data_.getBytes() == data_.getBytes(); +} + +template +bool image_view::operator<(image_view const& rhs) const +{ + return data_.getSize() < rhs.data_.getSize(); +} + template inline unsigned image_view::x() const {