diff options
Diffstat (limited to 'core/fxcrt/fx_coordinates.cpp')
-rw-r--r-- | core/fxcrt/fx_coordinates.cpp | 63 |
1 files changed, 63 insertions, 0 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; |