From 878b27de2fa8e5bdc3b910c98846f4b43185d4aa Mon Sep 17 00:00:00 2001 From: Jane Liu Date: Tue, 22 Aug 2017 10:50:06 -0400 Subject: Converted CFX_Matrix::TransformRect() to take in consts Currently, all three of CFX_Matrix::TransformRect() take in rect values and modify them in place. This CL converts them to take in constant values and return the transformed values instead, and fixes all the call sites. Bug=pdfium:874 Change-Id: I9c274df3b14e9d88c100ba0530068e06e8fec32b Reviewed-on: https://pdfium-review.googlesource.com/11550 Reviewed-by: dsinclair Commit-Queue: Jane Liu --- xfa/fxfa/cxfa_fffield.cpp | 6 ++---- xfa/fxfa/cxfa_ffpushbutton.cpp | 2 +- xfa/fxfa/cxfa_fftext.cpp | 3 +-- xfa/fxfa/cxfa_fwladapterwidgetmgr.cpp | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index 31003417a8..bfc9e4edbc 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -52,9 +52,7 @@ CFX_RectF CXFA_FFField::GetBBox(uint32_t dwStatus, bool bDrawFocus) { return CFX_RectF(); } - CFX_RectF rtBox = m_rtUI; - GetRotateMatrix().TransformRect(rtBox); - return rtBox; + return GetRotateMatrix().TransformRect(m_rtUI); } void CXFA_FFField::RenderWidget(CXFA_Graphics* pGS, @@ -619,7 +617,7 @@ void CXFA_FFField::RenderCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) { CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice(); CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top); if (pMatrix) { - pMatrix->TransformRect(rtClip); + rtClip = pMatrix->TransformRect(rtClip); mt.Concat(*pMatrix); } pCapTextLayout->DrawString(pRenderDevice, mt, rtClip); diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp index d201e42c86..63079cfaa0 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.cpp +++ b/xfa/fxfa/cxfa_ffpushbutton.cpp @@ -176,7 +176,7 @@ void CXFA_FFPushButton::RenderHighlightCaption(CXFA_Graphics* pGS, rtClip.Intersect(GetRectWithoutRotate()); CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top); if (pMatrix) { - pMatrix->TransformRect(rtClip); + rtClip = pMatrix->TransformRect(rtClip); mt.Concat(*pMatrix); } diff --git a/xfa/fxfa/cxfa_fftext.cpp b/xfa/fxfa/cxfa_fftext.cpp index 6246ec5731..274f3bfb61 100644 --- a/xfa/fxfa/cxfa_fftext.cpp +++ b/xfa/fxfa/cxfa_fftext.cpp @@ -61,8 +61,7 @@ void CXFA_FFText::RenderWidget(CXFA_Graphics* pGS, } CFX_Matrix mt(1, 0, 0, 1, rtText.left, rtText.top); - CFX_RectF rtClip = rtText; - mtRotate.TransformRect(rtClip); + CFX_RectF rtClip = mtRotate.TransformRect(rtText); mt.Concat(mtRotate); pTextLayout->DrawString(pRenderDevice, mt, rtClip, GetIndex()); } diff --git a/xfa/fxfa/cxfa_fwladapterwidgetmgr.cpp b/xfa/fxfa/cxfa_fwladapterwidgetmgr.cpp index 4dacd0300b..6fdd553712 100644 --- a/xfa/fxfa/cxfa_fwladapterwidgetmgr.cpp +++ b/xfa/fxfa/cxfa_fwladapterwidgetmgr.cpp @@ -30,8 +30,8 @@ bool CXFA_FWLAdapterWidgetMgr::GetPopupPos(CFWL_Widget* pWidget, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) { CXFA_FFWidget* pFFWidget = pWidget->GetLayoutItem(); - CFX_RectF rtRotateAnchor(rtAnchor); - pFFWidget->GetRotateMatrix().TransformRect(rtRotateAnchor); + CFX_RectF rtRotateAnchor = + pFFWidget->GetRotateMatrix().TransformRect(rtAnchor); pFFWidget->GetDoc()->GetDocEnvironment()->GetPopupPos( pFFWidget, fMinHeight, fMaxHeight, rtRotateAnchor, rtPopup); return true; -- cgit v1.2.3