summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_checkbox.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-07 16:36:39 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-08 01:36:02 +0000
commitbba2a7cf30da9e84bcc14ef32dbb0bb944229219 (patch)
tree94a74de8d07b3e395bf6e08a62811a3a0d652d19 /xfa/fwl/cfwl_checkbox.cpp
parent55e026b7b6eec17b012c819c4a7d39e63094b5c4 (diff)
downloadpdfium-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_checkbox.cpp')
-rw-r--r--xfa/fwl/cfwl_checkbox.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index 4a2d2dbaee..2dc0808831 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -129,27 +129,21 @@ void CFWL_CheckBox::Layout() {
FXSYS_round(m_pProperties->m_rtWidget.height);
m_rtClient = GetClientRect();
- FX_FLOAT fBoxTop = m_rtClient.top;
- FX_FLOAT fBoxLeft = m_rtClient.left;
- FX_FLOAT fTextLeft = fBoxLeft + m_fBoxHeight;
- FX_FLOAT fTextRight = m_rtClient.right();
- m_rtBox.Set(fBoxLeft, fBoxTop, m_fBoxHeight, m_fBoxHeight);
- m_rtCaption.Set(fTextLeft, m_rtClient.top, fTextRight - fTextLeft,
- m_rtClient.height);
+ FX_FLOAT fTextLeft = m_rtClient.left + m_fBoxHeight;
+ m_rtBox = CFX_RectF(m_rtClient.TopLeft(), m_fBoxHeight, m_fBoxHeight);
+ m_rtCaption = CFX_RectF(fTextLeft, m_rtClient.top,
+ m_rtClient.right() - fTextLeft, m_rtClient.height);
m_rtCaption.Inflate(-kCaptionMargin, -kCaptionMargin);
- CFX_RectF rtFocus;
- rtFocus.Set(m_rtCaption.left, m_rtCaption.top, m_rtCaption.width,
- m_rtCaption.height);
+ CFX_RectF rtFocus(m_rtCaption.left, m_rtCaption.top, m_rtCaption.width,
+ m_rtCaption.height);
CalcTextRect(L"Check box", m_pProperties->m_pThemeProvider, m_dwTTOStyles,
m_iTTOAlign, rtFocus);
- FX_FLOAT fWidth = std::max(m_rtCaption.width, rtFocus.width);
- FX_FLOAT fHeight = std::min(m_rtCaption.height, rtFocus.height);
- FX_FLOAT fLeft = m_rtCaption.left;
- FX_FLOAT fTop = m_rtCaption.top;
- m_rtFocus.Set(fLeft, fTop, fWidth, fHeight);
+ m_rtFocus = CFX_RectF(m_rtCaption.TopLeft(),
+ std::max(m_rtCaption.width, rtFocus.width),
+ std::min(m_rtCaption.height, rtFocus.height));
m_rtFocus.Inflate(1, 1);
}
@@ -195,9 +189,8 @@ void CFWL_CheckBox::NextStates() {
if (pCheckBox != this &&
pCheckBox->GetStates() & FWL_STATE_CKB_Checked) {
pCheckBox->SetCheckState(0);
- CFX_RectF rt = pCheckBox->GetWidgetRect();
- rt.left = rt.top = 0;
- m_pWidgetMgr->RepaintWidget(pCheckBox, rt);
+ m_pWidgetMgr->RepaintWidget(
+ pCheckBox, CFX_RectF(0, 0, pCheckBox->GetWidgetRect().Size()));
break;
}
}