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/src/fxcrt | |
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/src/fxcrt')
-rw-r--r-- | core/src/fxcrt/fx_basic_coords.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/core/src/fxcrt/fx_basic_coords.cpp b/core/src/fxcrt/fx_basic_coords.cpp index 27feb55113..4f723ef919 100644 --- a/core/src/fxcrt/fx_basic_coords.cpp +++ b/core/src/fxcrt/fx_basic_coords.cpp @@ -187,22 +187,22 @@ FX_RECT CFX_FloatRect::GetClosestRect() const { rect.Normalize(); return rect; } -FX_BOOL CFX_FloatRect::Contains(const CFX_FloatRect& other_rect) const { - CFX_FloatRect n1 = *this; + +bool CFX_FloatRect::Contains(const CFX_FloatRect& other_rect) const { + CFX_FloatRect n1(*this); + CFX_FloatRect n2(other_rect); n1.Normalize(); - CFX_FloatRect n2 = other_rect; n2.Normalize(); - if (n2.left >= n1.left && n2.right <= n1.right && n2.bottom >= n1.bottom && - n2.top <= n1.top) { - return TRUE; - } - return FALSE; + return n2.left >= n1.left && n2.right <= n1.right && n2.bottom >= n1.bottom && + n2.top <= n1.top; } -FX_BOOL CFX_FloatRect::Contains(FX_FLOAT x, FX_FLOAT y) const { - CFX_FloatRect n1 = *this; + +bool CFX_FloatRect::Contains(FX_FLOAT x, FX_FLOAT y) const { + CFX_FloatRect n1(*this); n1.Normalize(); return x <= n1.right && x >= n1.left && y <= n1.top && y >= n1.bottom; } + void CFX_FloatRect::UpdateRect(FX_FLOAT x, FX_FLOAT y) { if (left > x) { left = x; |