diff options
author | Lei Zhang <thestig@chromium.org> | 2017-12-01 20:09:21 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-12-01 20:09:21 +0000 |
commit | 752e9bf892abdf1ee588ba87c857d0783a017b27 (patch) | |
tree | 8b182a64630381f5eb0aabd4920f27b2ed8d355d /core/fxcrt/fx_coordinates.h | |
parent | 967af6fabb527e58d0b166b2db1f9c44d9450402 (diff) | |
download | pdfium-752e9bf892abdf1ee588ba87c857d0783a017b27.tar.xz |
Add CFX_FloatRect::ToRoundedFxRect().
Unlike ToFxRect(), which floors the LBRT values. Also fix some nits.
Change-Id: I0680eebb09031807a14402ca30b13558ea5b56d9
Reviewed-on: https://pdfium-review.googlesource.com/20213
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcrt/fx_coordinates.h')
-rw-r--r-- | core/fxcrt/fx_coordinates.h | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index 5da86102f0..1767e33f0c 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -233,14 +233,11 @@ class CFX_FloatRect { explicit CFX_FloatRect(const FX_RECT& rect); + static CFX_FloatRect GetBBox(const CFX_PointF* pPoints, int nPoints); + void Normalize(); - void Reset() { - left = 0.0f; - right = 0.0f; - bottom = 0.0f; - top = 0.0f; - } + void Reset(); bool IsEmpty() const { return left >= right || bottom >= top; } @@ -332,12 +329,8 @@ class CFX_FloatRect { void Scale(float fScale); void ScaleFromCenterPoint(float fScale); - static CFX_FloatRect GetBBox(const CFX_PointF* pPoints, int nPoints); - - FX_RECT ToFxRect() const { - return FX_RECT(static_cast<int32_t>(left), static_cast<int32_t>(top), - static_cast<int32_t>(right), static_cast<int32_t>(bottom)); - } + FX_RECT ToFxRect() const; + FX_RECT ToRoundedFxRect() const; float left; float bottom; |