Added bugfix for image_view where if an image of zero width or height created a view, it would cause a segfault because it created a 1,1 size view.
This commit is contained in:
parent
073e46aad8
commit
ffad24f31d
1 changed files with 4 additions and 4 deletions
|
@ -43,10 +43,10 @@ public:
|
||||||
height_(height),
|
height_(height),
|
||||||
data_(data)
|
data_(data)
|
||||||
{
|
{
|
||||||
if (x_ >= data_.width()) x_=data_.width()-1;
|
if (x_ >= data_.width() && data_.width() > 0) x_ = data_.width() - 1;
|
||||||
if (y_ >= data_.height()) y_=data_.height()-1;
|
if (y_ >= data_.height() && data.height() > 0) y_ = data_.height() - 1;
|
||||||
if (x_ + width_ > data_.width()) width_= data_.width() - x_;
|
if (x_ + width_ > data_.width()) width_ = data_.width() - x_;
|
||||||
if (y_ + height_ > data_.height()) height_= data_.height() - y_;
|
if (y_ + height_ > data_.height()) height_ = data_.height() - y_;
|
||||||
}
|
}
|
||||||
|
|
||||||
~image_view() {}
|
~image_view() {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue