summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_coordinates.h
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-07-13 21:36:29 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-17 15:43:06 +0000
commitd6aff2f2e8469344becd6f73e443c31bca9baac0 (patch)
tree1e14517547352b92e66f5256652debb3341acec4 /core/fxcrt/fx_coordinates.h
parent18531230381465592e1a037e6dfc39d4a6fb5def (diff)
downloadpdfium-d6aff2f2e8469344becd6f73e443c31bca9baac0.tar.xz
Add CFX_FloatRect::GetDeflated
This CL adds a method to CFX_FloatRect to get a new deflated rectangle from a given rectangle. Change-Id: I781222257c82baf94d5f77deede52fbe4e97c701 Reviewed-on: https://pdfium-review.googlesource.com/7850 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/fx_coordinates.h')
-rw-r--r--core/fxcrt/fx_coordinates.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h
index 79f7d4f29e..bcbdc0b804 100644
--- a/core/fxcrt/fx_coordinates.h
+++ b/core/fxcrt/fx_coordinates.h
@@ -543,6 +543,16 @@ class CFX_FloatRect {
Deflate(rt.left, rt.bottom, rt.right, rt.top);
}
+ 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;