diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-29 17:27:50 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-29 17:27:50 -0800 |
commit | 020fd8a9f715b7a0e9f9d9689245ebee1e2e7e18 (patch) | |
tree | 6cc766fc0414435079d2c96c59f44a7038ee16db /core/include | |
parent | ac4b8361e7919c6188587b89cbfbb748b3079b5b (diff) | |
download | pdfium-020fd8a9f715b7a0e9f9d9689245ebee1e2e7e18.tar.xz |
Add CFX_FloatRect::ToFxRect().
R=dsinclair@chromium.org
Review URL: https://codereview.chromium.org/1752543002 .
Diffstat (limited to 'core/include')
-rw-r--r-- | core/include/fxcrt/fx_coordinates.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/core/include/fxcrt/fx_coordinates.h b/core/include/fxcrt/fx_coordinates.h index 2cd249310e..2f52f78b8f 100644 --- a/core/include/fxcrt/fx_coordinates.h +++ b/core/include/fxcrt/fx_coordinates.h @@ -185,10 +185,10 @@ struct FX_RECT { static_cast<uint16_t>(right), static_cast<uint16_t>(bottom)); } - int left; - int top; - int right; - int bottom; + int32_t left; + int32_t top; + int32_t right; + int32_t bottom; }; // LBRT rectangles (y-axis runs upwards). @@ -220,9 +220,9 @@ class CFX_FloatRect { top = 0.0f; } - FX_BOOL IsEmpty() const { return left >= right || bottom >= top; } - FX_BOOL Contains(const CFX_FloatRect& other_rect) const; - FX_BOOL Contains(FX_FLOAT x, FX_FLOAT y) const; + bool IsEmpty() const { return left >= right || bottom >= top; } + bool Contains(const CFX_FloatRect& other_rect) const; + bool Contains(FX_FLOAT x, FX_FLOAT y) const; void Transform(const CFX_Matrix* pMatrix); void Intersect(const CFX_FloatRect& other_rect); @@ -300,6 +300,11 @@ class CFX_FloatRect { 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_FLOAT left; FX_FLOAT bottom; FX_FLOAT right; |