From 28995e606991189ddc4fdc8aba5db438554f5ce2 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Sat, 6 Oct 2018 05:50:28 +0000 Subject: Move CFX_FloatRect method impls out of the header. Change-Id: Ice814a84f699ea32325e98bbcea1a5b7db065fc6 Reviewed-on: https://pdfium-review.googlesource.com/c/43572 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- core/fxcrt/fx_coordinates.cpp | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'core/fxcrt/fx_coordinates.cpp') 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; -- cgit v1.2.3