summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-09 19:13:55 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-09 19:13:55 +0000
commit09ee087b894679ff7bc6bc17c7e8a8410e00f8b5 (patch)
tree7558e4680970e1657c9769785317d3d63cd6de69 /fpdfsdk
parentf9718052794c4669a4f99d8f798806c9730a9e36 (diff)
downloadpdfium-09ee087b894679ff7bc6bc17c7e8a8410e00f8b5.tar.xz
Pass CFX_Matrix by const-ref in various OnDraw() methods.
Change-Id: I6e953206520c024b2fc23b9b60c5c43112d04896 Reviewed-on: https://pdfium-review.googlesource.com/c/43603 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/cpdfsdk_annothandlermgr.cpp4
-rw-r--r--fpdfsdk/cpdfsdk_annothandlermgr.h2
-rw-r--r--fpdfsdk/cpdfsdk_baannothandler.cpp4
-rw-r--r--fpdfsdk/cpdfsdk_baannothandler.h2
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp10
-rw-r--r--fpdfsdk/cpdfsdk_pageview.h6
-rw-r--r--fpdfsdk/cpdfsdk_widgethandler.cpp6
-rw-r--r--fpdfsdk/cpdfsdk_widgethandler.h2
-rw-r--r--fpdfsdk/cpdfsdk_xfawidgethandler.cpp7
-rw-r--r--fpdfsdk/cpdfsdk_xfawidgethandler.h2
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.cpp10
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.h2
-rw-r--r--fpdfsdk/fpdf_formfill.cpp2
-rw-r--r--fpdfsdk/ipdfsdk_annothandler.h2
14 files changed, 30 insertions, 31 deletions
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index 2fd7f925c1..3dc3f09a07 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -118,10 +118,10 @@ IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
bool bDrawAnnots) {
ASSERT(pAnnot);
- GetAnnotHandler(pAnnot)->OnDraw(pPageView, pAnnot, pDevice, pUser2Device,
+ GetAnnotHandler(pAnnot)->OnDraw(pPageView, pAnnot, pDevice, mtUser2Device,
bDrawAnnots);
}
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.h b/fpdfsdk/cpdfsdk_annothandlermgr.h
index 799a1bee81..55b13f3a9b 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.h
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.h
@@ -53,7 +53,7 @@ class CPDFSDK_AnnotHandlerMgr {
void Annot_OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
bool bDrawAnnots);
void Annot_OnMouseEnter(CPDFSDK_PageView* pPageView,
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp
index a5969c98a2..93d3e46fdf 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -65,14 +65,14 @@ void CPDFSDK_BAAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
void CPDFSDK_BAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
bool bDrawAnnots) {
#ifdef PDF_ENABLE_XFA
if (pAnnot->IsXFAField())
return;
#endif // PDF_ENABLE_XFA
if (bDrawAnnots && pAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::POPUP) {
- pAnnot->AsBAAnnot()->DrawAppearance(pDevice, *pUser2Device,
+ pAnnot->AsBAAnnot()->DrawAppearance(pDevice, mtUser2Device,
CPDF_Annot::Normal, nullptr);
}
}
diff --git a/fpdfsdk/cpdfsdk_baannothandler.h b/fpdfsdk/cpdfsdk_baannothandler.h
index 53c06f1557..5adabc2b48 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.h
+++ b/fpdfsdk/cpdfsdk_baannothandler.h
@@ -49,7 +49,7 @@ class CPDFSDK_BAAnnotHandler final : public IPDFSDK_AnnotHandler {
void OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
bool bDrawAnnots) override;
void OnLoad(CPDFSDK_Annot* pAnnot) override;
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 0713d29a5f..ff87ea8465 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -63,10 +63,10 @@ CPDFSDK_PageView::~CPDFSDK_PageView() {
}
void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
CPDF_RenderOptions* pOptions,
const FX_RECT& pClip) {
- m_curMatrix = *pUser2Device;
+ m_curMatrix = mtUser2Device;
#ifdef PDF_ENABLE_XFA
CPDFXFA_Page* pPage = GetPDFXFAPage();
@@ -83,7 +83,7 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
gs.SetClipRect(rectClip);
CXFA_FFPageView* xfaView = pPage->GetXFAPageView();
- CXFA_RenderContext renderContext(xfaView, rectClip, *pUser2Device);
+ CXFA_RenderContext renderContext(xfaView, rectClip, mtUser2Device);
renderContext.DoRender(&gs);
CXFA_FFDocView* docView = xfaView->GetDocView();
@@ -94,7 +94,7 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
return;
// Render the focus widget
docView->GetWidgetHandler()->RenderWidget(annot->GetXFAWidget(), &gs,
- *pUser2Device, false);
+ mtUser2Device, false);
return;
}
#endif // PDF_ENABLE_XFA
@@ -103,7 +103,7 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
CPDFSDK_AnnotIteration annotIteration(this, true);
for (const auto& pSDKAnnot : annotIteration) {
m_pFormFillEnv->GetAnnotHandlerMgr()->Annot_OnDraw(
- this, pSDKAnnot.Get(), pDevice, pUser2Device,
+ this, pSDKAnnot.Get(), pDevice, mtUser2Device,
pOptions->GetDrawAnnots());
}
}
diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h
index 46c35e1e2d..4674c1bbb8 100644
--- a/fpdfsdk/cpdfsdk_pageview.h
+++ b/fpdfsdk/cpdfsdk_pageview.h
@@ -26,7 +26,7 @@ class CPDFSDK_PageView final : public CPDF_Page::View {
~CPDFSDK_PageView();
void PageView_OnDraw(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
CPDF_RenderOptions* pOptions,
const FX_RECT& pClip);
@@ -88,8 +88,8 @@ class CPDFSDK_PageView final : public CPDF_Page::View {
int GetPageIndex() const;
void SetValid(bool bValid) { m_bValid = bValid; }
- bool IsValid() { return m_bValid; }
- bool IsLocked() { return m_bLocked; }
+ bool IsValid() const { return m_bValid; }
+ bool IsLocked() const { return m_bLocked; }
void SetBeingDestroyed() { m_bBeingDestroyed = true; }
bool IsBeingDestroyed() const { return m_bBeingDestroyed; }
void TakePageOwnership() { m_pOwnsPage.Reset(ToPDFPage(m_page)); }
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index 7cfe74f413..70d0397b3c 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -89,14 +89,14 @@ void CPDFSDK_WidgetHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
void CPDFSDK_WidgetHandler::OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
bool bDrawAnnots) {
if (pAnnot->IsSignatureWidget()) {
- pAnnot->AsBAAnnot()->DrawAppearance(pDevice, *pUser2Device,
+ pAnnot->AsBAAnnot()->DrawAppearance(pDevice, mtUser2Device,
CPDF_Annot::Normal, nullptr);
} else {
if (m_pFormFiller)
- m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device);
+ m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, mtUser2Device);
}
}
diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h
index 82ea549c9d..c74869c77c 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.h
+++ b/fpdfsdk/cpdfsdk_widgethandler.h
@@ -50,7 +50,7 @@ class CPDFSDK_WidgetHandler final : public IPDFSDK_AnnotHandler {
void OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
bool bDrawAnnots) override;
void OnLoad(CPDFSDK_Annot* pAnnot) override;
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index 82eda21469..eeccf21584 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -49,20 +49,19 @@ CPDFSDK_Annot* CPDFSDK_XFAWidgetHandler::NewAnnot(CXFA_FFWidget* pAnnot,
void CPDFSDK_XFAWidgetHandler::OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
bool bDrawAnnots) {
ASSERT(pPageView);
ASSERT(pAnnot);
CXFA_Graphics gs(pDevice);
- CFX_Matrix mt = *pUser2Device;
bool bIsHighlight = false;
if (pPageView->GetFormFillEnv()->GetFocusAnnot() != pAnnot)
bIsHighlight = true;
- GetXFAWidgetHandler(pAnnot)->RenderWidget(pAnnot->GetXFAWidget(), &gs, mt,
- bIsHighlight);
+ GetXFAWidgetHandler(pAnnot)->RenderWidget(pAnnot->GetXFAWidget(), &gs,
+ mtUser2Device, bIsHighlight);
// to do highlight and shadow
}
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.h b/fpdfsdk/cpdfsdk_xfawidgethandler.h
index 442d10ba85..5b685565b0 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.h
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.h
@@ -45,7 +45,7 @@ class CPDFSDK_XFAWidgetHandler final : public IPDFSDK_AnnotHandler {
void OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
bool bDrawAnnots) override;
void OnLoad(CPDFSDK_Annot* pAnnot) override;
void OnMouseEnter(CPDFSDK_PageView* pPageView,
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index d76ce99578..cef2a45011 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -56,7 +56,7 @@ FX_RECT CFFL_InteractiveFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView,
void CFFL_InteractiveFormFiller::OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
+ const CFX_Matrix& mtUser2Device) {
ASSERT(pPageView);
CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot);
if (!IsVisible(pWidget))
@@ -64,7 +64,7 @@ void CFFL_InteractiveFormFiller::OnDraw(CPDFSDK_PageView* pPageView,
CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false);
if (pFormFiller && pFormFiller->IsValid()) {
- pFormFiller->OnDraw(pPageView, pAnnot, pDevice, *pUser2Device);
+ pFormFiller->OnDraw(pPageView, pAnnot, pDevice, mtUser2Device);
pAnnot->GetPDFPage();
if (m_pFormFillEnv->GetFocusAnnot() != pAnnot)
return;
@@ -89,16 +89,16 @@ void CFFL_InteractiveFormFiller::OnDraw(CPDFSDK_PageView* pPageView,
gsd.m_DashArray = {1.0f};
gsd.m_DashPhase = 0;
gsd.m_LineWidth = 1.0f;
- pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255, 0, 0, 0),
+ pDevice->DrawPath(&path, &mtUser2Device, &gsd, 0, ArgbEncode(255, 0, 0, 0),
FXFILL_ALTERNATE);
return;
}
pFormFiller = GetFormFiller(pAnnot, false);
if (pFormFiller) {
- pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, *pUser2Device);
+ pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, mtUser2Device);
} else {
- pWidget->DrawAppearance(pDevice, *pUser2Device, CPDF_Annot::Normal,
+ pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Normal,
nullptr);
}
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
index 46248d651b..bf9fa3c09c 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -34,7 +34,7 @@ class CFFL_InteractiveFormFiller final : public IPWL_Filler_Notify {
void OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device);
+ const CFX_Matrix& mtUser2Device);
void OnDelete(CPDFSDK_Annot* pAnnot);
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index 644f332db4..056559abe8 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -211,7 +211,7 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
pdfium::MakeRetain<CPDF_OCContext>(pPDFDoc, CPDF_OCContext::View));
if (pPageView)
- pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, rect);
+ pPageView->PageView_OnDraw(pDevice.get(), matrix, &options, rect);
}
#ifdef _SKIA_SUPPORT_PATHS_
diff --git a/fpdfsdk/ipdfsdk_annothandler.h b/fpdfsdk/ipdfsdk_annothandler.h
index 11c43ecf0b..61c0ad0cb5 100644
--- a/fpdfsdk/ipdfsdk_annothandler.h
+++ b/fpdfsdk/ipdfsdk_annothandler.h
@@ -49,7 +49,7 @@ class IPDFSDK_AnnotHandler {
virtual void OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
bool bDrawAnnots) = 0;
virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0;