diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-07 16:36:39 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-08 01:36:02 +0000 |
commit | bba2a7cf30da9e84bcc14ef32dbb0bb944229219 (patch) | |
tree | 94a74de8d07b3e395bf6e08a62811a3a0d652d19 /xfa/fwl/cfwl_scrollbar.cpp | |
parent | 55e026b7b6eec17b012c819c4a7d39e63094b5c4 (diff) | |
download | pdfium-bba2a7cf30da9e84bcc14ef32dbb0bb944229219.tar.xz |
Update to use CFX_Rect{F} and CFX_Matrix constructors.
This Cl updates the code to use the constructors instead of creating an
empty object and calling Set(). It also removes the various memsets of
the CFX_Rect{F} classes.
Change-Id: I6e20cec00866a38372858dcba5a30d31103172e4
Reviewed-on: https://pdfium-review.googlesource.com/2550
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fwl/cfwl_scrollbar.cpp')
-rw-r--r-- | xfa/fwl/cfwl_scrollbar.cpp | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp index d4dd8885e3..b928d4c5b3 100644 --- a/xfa/fwl/cfwl_scrollbar.cpp +++ b/xfa/fwl/cfwl_scrollbar.cpp @@ -176,30 +176,22 @@ void CFWL_ScrollBar::CalcButtonLen() { } CFX_RectF CFWL_ScrollBar::CalcMinButtonRect() { - CFX_RectF rect; if (IsVertical()) - rect.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width, m_fButtonLen); - else - rect.Set(m_rtClient.left, m_rtClient.top, m_fButtonLen, m_rtClient.height); - return rect; + return CFX_RectF(m_rtClient.TopLeft(), m_rtClient.width, m_fButtonLen); + return CFX_RectF(m_rtClient.TopLeft(), m_fButtonLen, m_rtClient.height); } CFX_RectF CFWL_ScrollBar::CalcMaxButtonRect() { - CFX_RectF rect; if (IsVertical()) { - rect.Set(m_rtClient.left, m_rtClient.bottom() - m_fButtonLen, - m_rtClient.width, m_fButtonLen); - } else { - rect.Set(m_rtClient.right() - m_fButtonLen, m_rtClient.top, m_fButtonLen, - m_rtClient.height); + return CFX_RectF(m_rtClient.left, m_rtClient.bottom() - m_fButtonLen, + m_rtClient.width, m_fButtonLen); } - return rect; + return CFX_RectF(m_rtClient.right() - m_fButtonLen, m_rtClient.top, + m_fButtonLen, m_rtClient.height); } CFX_RectF CFWL_ScrollBar::CalcThumbButtonRect(const CFX_RectF& rtThumb) { CFX_RectF rect; - rect.Reset(); - if (!IsEnabled()) return rect; @@ -211,11 +203,11 @@ CFX_RectF CFWL_ScrollBar::CalcThumbButtonRect(const CFX_RectF& rtThumb) { FX_FLOAT fRange = m_fRangeMax - m_fRangeMin; if (fRange < 0) { - if (IsVertical()) - rect.Set(m_rtClient.left, m_rtMaxBtn.bottom(), m_rtClient.width, 0); - else - rect.Set(m_rtMaxBtn.right(), m_rtClient.top, 0, m_rtClient.height); - return rect; + if (IsVertical()) { + return CFX_RectF(m_rtClient.left, m_rtMaxBtn.bottom(), m_rtClient.width, + 0); + } + return CFX_RectF(m_rtMaxBtn.right(), m_rtClient.top, 0, m_rtClient.height); } CFX_RectF rtClient = m_rtClient; @@ -251,8 +243,6 @@ CFX_RectF CFWL_ScrollBar::CalcThumbButtonRect(const CFX_RectF& rtThumb) { CFX_RectF CFWL_ScrollBar::CalcMinTrackRect(const CFX_RectF& rtMinRect) { CFX_RectF rect; - rect.Reset(); - if (m_bMinSize) { rect.left = rtMinRect.left; rect.top = rtMinRect.top; @@ -272,20 +262,18 @@ CFX_RectF CFWL_ScrollBar::CalcMinTrackRect(const CFX_RectF& rtMinRect) { } CFX_RectF CFWL_ScrollBar::CalcMaxTrackRect(const CFX_RectF& rtMaxRect) { - CFX_RectF rect; - if (m_bMinSize) { - rect.Set(rtMaxRect.left, rtMaxRect.top, 0, 0); - return rect; - } + if (m_bMinSize) + return CFX_RectF(rtMaxRect.TopLeft(), 0, 0); if (IsVertical()) { FX_FLOAT iy = (m_rtThumb.top + m_rtThumb.bottom()) / 2; - rect.Set(m_rtClient.left, iy, m_rtClient.width, m_rtClient.bottom() - iy); - } else { - FX_FLOAT ix = (m_rtThumb.left + m_rtThumb.right()) / 2; - rect.Set(ix, m_rtClient.top, m_rtClient.height - ix, m_rtClient.height); + return CFX_RectF(m_rtClient.left, iy, m_rtClient.width, + m_rtClient.bottom() - iy); } - return rect; + + FX_FLOAT ix = (m_rtThumb.left + m_rtThumb.right()) / 2; + return CFX_RectF(ix, m_rtClient.top, m_rtClient.height - ix, + m_rtClient.height); } FX_FLOAT CFWL_ScrollBar::GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy) { |