From 77f9bff2c229df771a43448a9d5087e042235936 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 29 Aug 2017 11:34:12 -0700 Subject: Reduce rounding errors when Invalidating rects. Instead of using CFX_FloatRect::ToFxRect(), which always rounds down, use GetOuterRect() which correctly rounds up / down depending on the side of the rectangle. Change-Id: I7abd3a65e8c0467ed4303292f26a72737a5d553b Reviewed-on: https://pdfium-review.googlesource.com/12312 Commit-Queue: dsinclair Reviewed-by: dsinclair --- fpdfsdk/formfiller/cffl_formfiller.h | 3 ++- fpdfsdk/formfiller/cffl_textfield.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'fpdfsdk/formfiller') diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h index 2b276c242e..b5bf1c8197 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.h +++ b/fpdfsdk/formfiller/cffl_formfiller.h @@ -140,7 +140,6 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { CPDFSDK_PageView* GetCurPageView(bool renew); void SetChangeMark(); - virtual void InvalidateRect(const FX_RECT& rect); CPDFSDK_Annot* GetSDKAnnot() { return m_pWidget.Get(); } protected: @@ -154,6 +153,8 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { // until the PWL_Edit is done with it. pdfium:566 void DestroyWindows(); + void InvalidateRect(const FX_RECT& rect); + CFX_UnownedPtr const m_pFormFillEnv; CFX_UnownedPtr m_pWidget; bool m_bValid; diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp index d26b4a5599..f6f768a049 100644 --- a/fpdfsdk/formfiller/cffl_textfield.cpp +++ b/fpdfsdk/formfiller/cffl_textfield.cpp @@ -101,7 +101,7 @@ bool CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, ASSERT(pPageView); m_bValid = !m_bValid; m_pFormFillEnv->Invalidate(pAnnot->GetUnderlyingPage(), - pAnnot->GetRect().ToFxRect()); + pAnnot->GetRect().GetOuterRect()); if (m_bValid) { if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, true)) -- cgit v1.2.3