diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/fxcrt/fx_coordinates.cpp | 63 | ||||
-rw-r--r-- | core/fxcrt/fx_coordinates.h | 61 |
2 files changed, 71 insertions, 53 deletions
diff --git a/core/fxcrt/fx_coordinates.cpp b/core/fxcrt/fx_coordinates.cpp index e17a411bba..e08b13e97b 100644 --- a/core/fxcrt/fx_coordinates.cpp +++ b/core/fxcrt/fx_coordinates.cpp @@ -205,6 +205,69 @@ void CFX_FloatRect::UpdateRect(const CFX_PointF& point) { top = std::max(top, point.y); } +void CFX_FloatRect::Inflate(float x, float y) { + Normalize(); + left -= x; + right += x; + bottom -= y; + top += y; +} + +void CFX_FloatRect::Inflate(float other_left, + float other_bottom, + float other_right, + float other_top) { + Normalize(); + left -= other_left; + bottom -= other_bottom; + right += other_right; + top += other_top; +} + +void CFX_FloatRect::Inflate(const CFX_FloatRect& rt) { + Inflate(rt.left, rt.bottom, rt.right, rt.top); +} + +void CFX_FloatRect::Deflate(float x, float y) { + Normalize(); + left += x; + right -= x; + bottom += y; + top -= y; +} + +void CFX_FloatRect::Deflate(float other_left, + float other_bottom, + float other_right, + float other_top) { + Normalize(); + left += other_left; + bottom += other_bottom; + right -= other_right; + top -= other_top; +} + +void CFX_FloatRect::Deflate(const CFX_FloatRect& rt) { + Deflate(rt.left, rt.bottom, rt.right, rt.top); +} + +CFX_FloatRect CFX_FloatRect::GetDeflated(float x, float y) const { + if (IsEmpty()) + return CFX_FloatRect(); + + CFX_FloatRect that = *this; + that.Deflate(x, y); + that.Normalize(); + return that; +} + +void CFX_FloatRect::Translate(float e, float f) { + left += e; + right += e; + top += f; + bottom += f; +} + void CFX_FloatRect::Scale(float fScale) { left *= fScale; bottom *= fScale; diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index 9e41efc417..d01191da37 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -275,68 +275,23 @@ class CFX_FloatRect { float Width() const { return right - left; } float Height() const { return top - bottom; } - void Inflate(float x, float y) { - Normalize(); - left -= x; - right += x; - bottom -= y; - top += y; - } - + void Inflate(float x, float y); void Inflate(float other_left, float other_bottom, float other_right, - float other_top) { - Normalize(); - left -= other_left; - bottom -= other_bottom; - right += other_right; - top += other_top; - } - - void Inflate(const CFX_FloatRect& rt) { - Inflate(rt.left, rt.bottom, rt.right, rt.top); - } - - void Deflate(float x, float y) { - Normalize(); - left += x; - right -= x; - bottom += y; - top -= y; - } + float other_top); + void Inflate(const CFX_FloatRect& rt); + void Deflate(float x, float y); void Deflate(float other_left, float other_bottom, float other_right, - float other_top) { - Normalize(); - left += other_left; - bottom += other_bottom; - right -= other_right; - top -= other_top; - } + float other_top); + void Deflate(const CFX_FloatRect& rt); - void Deflate(const CFX_FloatRect& rt) { - Deflate(rt.left, rt.bottom, rt.right, rt.top); - } + CFX_FloatRect GetDeflated(float x, float y) const; - CFX_FloatRect GetDeflated(float x, float y) const { - if (IsEmpty()) - return CFX_FloatRect(); - - CFX_FloatRect that = *this; - that.Deflate(x, y); - that.Normalize(); - return that; - } - - void Translate(float e, float f) { - left += e; - right += e; - top += f; - bottom += f; - } + void Translate(float e, float f); void Scale(float fScale); void ScaleFromCenterPoint(float fScale); |