diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-07-13 13:44:40 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-13 18:31:06 +0000 |
commit | 334e79e15c271aeccacd65376e0050725d79d79d (patch) | |
tree | e7a19aa140a8ec32b04268dee355944849d48f08 /core/fxcrt | |
parent | 3628f8b06e4518c81971782455270d5db4ff91c9 (diff) | |
download | pdfium-334e79e15c271aeccacd65376e0050725d79d79d.tar.xz |
Move CPWL_Utils::ScaleRect to CFX_FloatRect
This CL moves the ScaleRect method to Scale on CFX_FloatRect and changes it to
operate directly on the rect.
Change-Id: Ie0f91c9319be08c9e2cc81cba2519ebb5f2c35eb
Reviewed-on: https://pdfium-review.googlesource.com/7714
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/fx_coordinates.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index a1bf11b207..79f7d4f29e 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -550,6 +550,19 @@ class CFX_FloatRect { bottom += f; } + void Scale(float fScale) { + float fHalfWidth = (right - left) / 2.0f; + float fHalfHeight = (top - bottom) / 2.0f; + + float center_x = (left + right) / 2; + float center_y = (top + bottom) / 2; + + left = center_x - fHalfWidth * fScale; + bottom = center_y - fHalfHeight * fScale; + right = center_x + fHalfWidth * fScale; + top = center_y + fHalfHeight * fScale; + } + static CFX_FloatRect GetBBox(const CFX_PointF* pPoints, int nPoints); FX_RECT ToFxRect() const { |