From d6aff2f2e8469344becd6f73e443c31bca9baac0 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 13 Jul 2017 21:36:29 -0400 Subject: 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 Reviewed-by: Tom Sepez --- core/fxcrt/fx_coordinates.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core') 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; -- cgit v1.2.3