summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/cfx_systemhandler.cpp4
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.cpp11
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.h6
-rw-r--r--fpdfsdk/cpdfsdk_interform.cpp10
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp5
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp35
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.h5
-rw-r--r--fpdfsdk/formfiller/cffl_textfield.cpp5
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp5
9 files changed, 29 insertions, 57 deletions
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
index 8ccbd75fbf..14d772952a 100644
--- a/fpdfsdk/cfx_systemhandler.cpp
+++ b/fpdfsdk/cfx_systemhandler.cpp
@@ -53,9 +53,7 @@ void CFX_SystemHandler::InvalidateRect(CPDFSDK_Widget* widget, FX_RECT rect) {
CFX_FloatRect rcPDF(left_top.x, right_bottom.y, right_bottom.x, left_top.y);
rcPDF.Normalize();
-
- m_pFormFillEnv->Invalidate(pPage, rcPDF.left, rcPDF.top, rcPDF.right,
- rcPDF.bottom);
+ m_pFormFillEnv->Invalidate(pPage, rcPDF.ToFxRect());
}
void CFX_SystemHandler::OutputSelectedRect(CFFL_FormFiller* pFormFiller,
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index b91c97842f..4aae48c828 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -233,12 +233,11 @@ CPDFSDK_FormFillEnvironment::GetInteractiveFormFiller() {
}
void CPDFSDK_FormFillEnvironment::Invalidate(FPDF_PAGE page,
- double left,
- double top,
- double right,
- double bottom) {
- if (m_pInfo && m_pInfo->FFI_Invalidate)
- m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom);
+ const FX_RECT& rect) {
+ if (m_pInfo && m_pInfo->FFI_Invalidate) {
+ m_pInfo->FFI_Invalidate(m_pInfo, page, rect.left, rect.top, rect.right,
+ rect.bottom);
+ }
}
void CPDFSDK_FormFillEnvironment::OutputSelectedRect(FPDF_PAGE page,
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h
index 8c2a8a33c8..b180e98104 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.h
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.h
@@ -68,11 +68,7 @@ class CPDFSDK_FormFillEnvironment
void ProcJavascriptFun();
bool ProcOpenAction();
- void Invalidate(FPDF_PAGE page,
- double left,
- double top,
- double right,
- double bottom);
+ void Invalidate(FPDF_PAGE page, const FX_RECT& rect);
void OutputSelectedRect(FPDF_PAGE page,
double left,
double top,
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 4229fcdac5..4ebcf8a2f3 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -321,18 +321,16 @@ void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField,
}
void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) {
+ auto formfiller = m_pFormFillEnv->GetInteractiveFormFiller();
for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
ASSERT(pFormCtrl);
if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) {
UnderlyingPageType* pPage = pWidget->GetUnderlyingPage();
- CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(pPage, false);
- FX_RECT rcBBox = m_pFormFillEnv->GetInteractiveFormFiller()->GetViewBBox(
- pPageView, pWidget);
-
- m_pFormFillEnv->Invalidate(pPage, rcBBox.left, rcBBox.top, rcBBox.right,
- rcBBox.bottom);
+ m_pFormFillEnv->Invalidate(
+ pPage, formfiller->GetViewBBox(
+ m_pFormFillEnv->GetPageView(pPage, false), pWidget));
}
}
}
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 1f041dfb25..c51cc2b71e 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -433,13 +433,12 @@ void CPDFSDK_PageView::LoadFXAnnots() {
void CPDFSDK_PageView::UpdateRects(const std::vector<CFX_FloatRect>& rects) {
for (const auto& rc : rects)
- m_pFormFillEnv->Invalidate(m_page, rc.left, rc.top, rc.right, rc.bottom);
+ m_pFormFillEnv->Invalidate(m_page, rc.ToFxRect());
}
void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) {
CFX_FloatRect rcWindow = pAnnot->GetRect();
- m_pFormFillEnv->Invalidate(m_page, rcWindow.left, rcWindow.top,
- rcWindow.right, rcWindow.bottom);
+ m_pFormFillEnv->Invalidate(m_page, rcWindow.ToFxRect());
}
int CPDFSDK_PageView::GetPageIndex() const {
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 36aaae0f29..44df8dd770 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -123,9 +123,8 @@ bool CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView,
if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, true)) {
m_bValid = true;
FX_RECT rect = GetViewBBox(pPageView, pAnnot);
- InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
-
- if (!rect.Contains((int)point.x, (int)point.y))
+ InvalidateRect(rect);
+ if (!rect.Contains(static_cast<int>(point.x), static_cast<int>(point.y)))
return false;
return pWnd->OnLButtonDown(WndtoPWL(pPageView, point), nFlags);
@@ -142,8 +141,7 @@ bool CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView,
if (!pWnd)
return false;
- FX_RECT rcFFL = GetViewBBox(pPageView, pAnnot);
- InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.bottom);
+ InvalidateRect(GetViewBBox(pPageView, pAnnot));
pWnd->OnLButtonUp(WndtoPWL(pPageView, point), nFlags);
return true;
}
@@ -249,8 +247,7 @@ void CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag) {
pWnd->SetFocus();
m_bValid = true;
- FX_RECT rcRect = GetViewBBox(pPageView, pAnnot);
- InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom);
+ InvalidateRect(GetViewBBox(pPageView, pAnnot));
}
void CFFL_FormFiller::KillFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag) {
@@ -592,19 +589,13 @@ void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView,
bool bDestroyPDFWindow) {
m_bValid = false;
- FX_RECT rcRect = GetViewBBox(pPageView, m_pWidget);
- InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom);
-
+ InvalidateRect(GetViewBBox(pPageView, m_pWidget));
if (bDestroyPDFWindow)
DestroyPDFWindow(pPageView);
}
-void CFFL_FormFiller::InvalidateRect(double left,
- double top,
- double right,
- double bottom) {
- UnderlyingPageType* pPage = m_pWidget->GetUnderlyingPage();
- m_pFormFillEnv->Invalidate(pPage, left, top, right, bottom);
+void CFFL_FormFiller::InvalidateRect(const FX_RECT& rect) {
+ m_pFormFillEnv->Invalidate(m_pWidget->GetUnderlyingPage(), rect);
}
CFFL_Button::CFFL_Button(CPDFSDK_FormFillEnvironment* pApp,
@@ -616,16 +607,14 @@ CFFL_Button::~CFFL_Button() {}
void CFFL_Button::OnMouseEnter(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) {
m_bMouseIn = true;
- FX_RECT rect = GetViewBBox(pPageView, pAnnot);
- InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
+ InvalidateRect(GetViewBBox(pPageView, pAnnot));
}
void CFFL_Button::OnMouseExit(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) {
m_bMouseIn = false;
- FX_RECT rect = GetViewBBox(pPageView, pAnnot);
- InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
+ InvalidateRect(GetViewBBox(pPageView, pAnnot));
EndTimer();
ASSERT(m_pWidget);
}
@@ -639,8 +628,7 @@ bool CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView,
m_bMouseDown = true;
m_bValid = true;
- FX_RECT rect = GetViewBBox(pPageView, pAnnot);
- InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
+ InvalidateRect(GetViewBBox(pPageView, pAnnot));
return true;
}
@@ -654,8 +642,7 @@ bool CFFL_Button::OnLButtonUp(CPDFSDK_PageView* pPageView,
m_bMouseDown = false;
m_pWidget->GetPDFPage();
- FX_RECT rect = GetViewBBox(pPageView, pAnnot);
- InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
+ InvalidateRect(GetViewBBox(pPageView, pAnnot));
return true;
}
diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h
index 7462b40e97..c6b1e59786 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.h
+++ b/fpdfsdk/formfiller/cffl_formfiller.h
@@ -138,10 +138,7 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler {
CPDFSDK_PageView* GetCurPageView(bool renew);
void SetChangeMark();
- virtual void InvalidateRect(double left,
- double top,
- double right,
- double bottom);
+ virtual void InvalidateRect(const FX_RECT& rect);
CPDFSDK_Annot* GetSDKAnnot() { return m_pAnnot; }
protected:
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index c1cd7868c8..91db0959db 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -114,9 +114,8 @@ bool CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot,
CPDFSDK_PageView* pPageView = GetCurPageView(true);
ASSERT(pPageView);
m_bValid = !m_bValid;
- CFX_FloatRect rcAnnot = pAnnot->GetRect();
- m_pFormFillEnv->Invalidate(pAnnot->GetUnderlyingPage(), rcAnnot.left,
- rcAnnot.top, rcAnnot.right, rcAnnot.bottom);
+ m_pFormFillEnv->Invalidate(pAnnot->GetUnderlyingPage(),
+ pAnnot->GetRect().ToFxRect());
if (m_bValid) {
if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, true))
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 962dbbae09..731b0cc296 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -71,9 +71,8 @@ void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView,
if (!pFormFillEnv)
return;
- CFX_FloatRect rcPage = CFX_FloatRect::FromCFXRectF(rt);
- pFormFillEnv->Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom,
- rcPage.right, rcPage.top);
+ pFormFillEnv->Invalidate(static_cast<FPDF_PAGE>(pPage),
+ CFX_FloatRect::FromCFXRectF(rt).ToFxRect());
}
void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget,