mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 03:39:51 +00:00
Overload gfx::Border class operators to increment/decrement border size.
This commit is contained in:
parent
f8e940d7a4
commit
a7ea661ad0
@ -24,6 +24,74 @@ Border::Border(int left, int top, int right, int bottom)
|
||||
m_bottom = bottom;
|
||||
}
|
||||
|
||||
const Border& Border::operator+=(int value)
|
||||
{
|
||||
m_left += value;
|
||||
m_top += value;
|
||||
m_right += value;
|
||||
m_bottom += value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Border& Border::operator-=(int value)
|
||||
{
|
||||
m_left -= value;
|
||||
m_top -= value;
|
||||
m_right -= value;
|
||||
m_bottom -= value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Border& Border::operator*=(int value)
|
||||
{
|
||||
m_left *= value;
|
||||
m_top *= value;
|
||||
m_right *= value;
|
||||
m_bottom *= value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Border& Border::operator/=(int value)
|
||||
{
|
||||
m_left /= value;
|
||||
m_top /= value;
|
||||
m_right /= value;
|
||||
m_bottom /= value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Border Border::operator+(int value) const
|
||||
{
|
||||
return Border(m_left + value,
|
||||
m_top + value,
|
||||
m_right + value,
|
||||
m_bottom + value);
|
||||
}
|
||||
|
||||
Border Border::operator-(int value) const
|
||||
{
|
||||
return Border(m_left - value,
|
||||
m_top - value,
|
||||
m_right - value,
|
||||
m_bottom - value);
|
||||
}
|
||||
|
||||
Border Border::operator*(int value) const
|
||||
{
|
||||
return Border(m_left * value,
|
||||
m_top * value,
|
||||
m_right * value,
|
||||
m_bottom * value);
|
||||
}
|
||||
|
||||
Border Border::operator/(int value) const
|
||||
{
|
||||
return Border(m_left / value,
|
||||
m_top / value,
|
||||
m_right / value,
|
||||
m_bottom / value);
|
||||
}
|
||||
|
||||
Border Border::operator-() const
|
||||
{
|
||||
return Border(-m_left, -m_top, -m_right, -m_bottom);
|
||||
|
@ -25,6 +25,14 @@ public:
|
||||
void right(int right) { m_right = right; }
|
||||
void bottom(int bottom) { m_bottom = bottom; }
|
||||
|
||||
const Border& operator+=(int value);
|
||||
const Border& operator-=(int value);
|
||||
const Border& operator*=(int value);
|
||||
const Border& operator/=(int value);
|
||||
Border operator+(int value) const;
|
||||
Border operator-(int value) const;
|
||||
Border operator*(int value) const;
|
||||
Border operator/(int value) const;
|
||||
Border operator-() const;
|
||||
|
||||
bool operator==(const Border& br) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user