Updated image_view any with < and == operators, removed default constructor from image_view and image_view_any
This commit is contained in:
parent
702b91e369
commit
f8010f0ba1
3 changed files with 17 additions and 3 deletions
|
@ -35,12 +35,14 @@ public:
|
||||||
using pixel_type = typename T::pixel_type;
|
using pixel_type = typename T::pixel_type;
|
||||||
static const image_dtype dtype = T::dtype;
|
static const image_dtype dtype = T::dtype;
|
||||||
static constexpr std::size_t pixel_size = sizeof(pixel_type);
|
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(unsigned x, unsigned y, unsigned width, unsigned height, T const& data);
|
||||||
~image_view();
|
~image_view();
|
||||||
|
|
||||||
image_view(image_view<T> const& rhs);
|
image_view(image_view<T> const& rhs);
|
||||||
image_view<T> & operator=(image_view<T> const& rhs);
|
image_view<T> & operator=(image_view<T> const& rhs);
|
||||||
|
bool operator==(image_view<T> const& rhs) const;
|
||||||
|
bool operator<(image_view<T> const& rhs) const;
|
||||||
|
|
||||||
unsigned x() const;
|
unsigned x() const;
|
||||||
unsigned y() const;
|
unsigned y() const;
|
||||||
|
|
|
@ -42,7 +42,7 @@ using image_view_base = util::variant<image_view_rgba8,
|
||||||
|
|
||||||
struct MAPNIK_DECL image_view_any : image_view_base
|
struct MAPNIK_DECL image_view_any : image_view_base
|
||||||
{
|
{
|
||||||
image_view_any() = default;
|
image_view_any() = delete;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
image_view_any(T && data) noexcept
|
image_view_any(T && data) noexcept
|
||||||
|
|
|
@ -62,6 +62,18 @@ image_view<T> & image_view<T>::operator=(image_view<T> const& rhs)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool image_view<T>::operator==(image_view<T> const& rhs) const
|
||||||
|
{
|
||||||
|
return rhs.data_.getBytes() == data_.getBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool image_view<T>::operator<(image_view<T> const& rhs) const
|
||||||
|
{
|
||||||
|
return data_.getSize() < rhs.data_.getSize();
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline unsigned image_view<T>::x() const
|
inline unsigned image_view<T>::x() const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue