From 0a91394b4edba9bc2110161c9a12cecab77ea9e3 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 1 Jun 2017 01:37:51 -0700 Subject: Remove explicit CFX_Matrix identity matrix instantiations. Change-Id: I96c3429dbe2c572ed409706adfe3707b8b9bf51b Reviewed-on: https://pdfium-review.googlesource.com/6176 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- core/fpdftext/cpdf_textpage.cpp | 2 +- fpdfsdk/cpdfsdk_widget.cpp | 3 +-- fpdfsdk/formfiller/cffl_formfiller.cpp | 25 ++++++++++--------------- xfa/fwl/cfwl_combobox.cpp | 2 +- xfa/fwl/theme/cfwl_checkboxtp.cpp | 2 +- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index e3db1c62c9..b8860122f1 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -590,7 +590,7 @@ void CPDF_TextPage::ProcessObject() { CFX_Matrix matrix; ProcessTextObject(pObj->AsText(), matrix, pObjList, it); } else if (pObj->IsForm()) { - CFX_Matrix formMatrix(1, 0, 0, 1, 0, 0); + CFX_Matrix formMatrix; ProcessFormObject(pObj->AsForm(), formMatrix); } } diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index 7d9357adb9..bd586a999c 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -1723,9 +1723,8 @@ CFX_Matrix CPDFSDK_Widget::GetMatrix() const { float fHeight = rcAnnot.top - rcAnnot.bottom; switch (abs(pControl->GetRotation() % 360)) { - case 0: default: - mt = CFX_Matrix(1, 0, 0, 1, 0, 0); + case 0: break; case 90: mt = CFX_Matrix(0, 1, -1, 0, fWidth, 0); diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 2bc240fc2e..98b914101d 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -386,29 +386,24 @@ void CFFL_FormFiller::DestroyPDFWindow(CPDFSDK_PageView* pPageView) { } CFX_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) { - if (CFFL_PrivateData* pPrivateData = (CFFL_PrivateData*)pAttachedData) { - if (pPrivateData->pPageView) { - CFX_Matrix mtPageView; - pPrivateData->pPageView->GetCurrentMatrix(mtPageView); - - CFX_Matrix mt = GetCurMatrix(); - mt.Concat(mtPageView); - - return mt; - } - } - return CFX_Matrix(1, 0, 0, 1, 0, 0); + CFX_Matrix mt; + auto* pPrivateData = reinterpret_cast(pAttachedData); + if (!pAttachedData || !pPrivateData->pPageView) + return mt; + + CFX_Matrix mtPageView; + pPrivateData->pPageView->GetCurrentMatrix(mtPageView); + mt = GetCurMatrix(); + mt.Concat(mtPageView); + return mt; } CFX_Matrix CFFL_FormFiller::GetCurMatrix() { CFX_Matrix mt; - CFX_FloatRect rcDA = m_pWidget->GetPDFAnnot()->GetRect(); - switch (m_pWidget->GetRotate()) { default: case 0: - mt = CFX_Matrix(1, 0, 0, 1, 0, 0); break; case 90: mt = CFX_Matrix(0, 1, -1, 0, rcDA.right - rcDA.left, 0); diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp index ba72d3d2b2..cdb4f81d67 100644 --- a/xfa/fwl/cfwl_combobox.cpp +++ b/xfa/fwl/cfwl_combobox.cpp @@ -618,7 +618,7 @@ FWL_WidgetHit CFWL_ComboBox::DisForm_HitTest(const CFX_PointF& point) { void CFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; - CFX_Matrix mtOrg(1, 0, 0, 1, 0, 0); + CFX_Matrix mtOrg; if (pMatrix) mtOrg = *pMatrix; diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index 0a3ae88a46..6386611b54 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -263,7 +263,7 @@ void CFWL_CheckBoxTP::InitCheckPath(float fCheckLen) { m_pCheckPath->BezierTo(pt5 + p1, pt1 + p2, pt1); float fScale = fCheckLen / kSignPath; - CFX_Matrix mt(1, 0, 0, 1, 0, 0); + CFX_Matrix mt; mt.Scale(fScale, fScale); m_pCheckPath->TransformBy(mt); -- cgit v1.2.3