image_data - fix setRow implementation

This commit is contained in:
artemp 2014-12-09 11:47:47 +01:00
parent 4e671fd0e9
commit 12f051bf56

View file

@ -188,7 +188,9 @@ public:
} }
inline void setRow(std::size_t row, std::size_t x0, std::size_t x1, pixel_type const* buf) inline void setRow(std::size_t row, std::size_t x0, std::size_t x1, pixel_type const* buf)
{ {
std::copy(buf, buf + (x1 - x0), pData_ + row * width_); assert(row < height_);
assert ((x1 - x0) <= width_ );
std::copy(buf, buf + (x1 - x0), pData_ + row * width_ + x0);
} }
private: private:
std::size_t width_; std::size_t width_;