diff options
author | Lei Zhang <thestig@chromium.org> | 2018-10-06 05:50:28 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-06 05:50:28 +0000 |
commit | 28995e606991189ddc4fdc8aba5db438554f5ce2 (patch) | |
tree | 88c86d9f11c3fb244de9edfd588833a654e6b1de /core | |
parent | d9826495fe0e279c6e2d587a656c7452cc2dc71f (diff) | |
download | pdfium-28995e606991189ddc4fdc8aba5db438554f5ce2.tar.xz |
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 <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
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); |