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/cpdfsdk_interform.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'fpdfsdk/cpdfsdk_interform.cpp') diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index 27db1053c6..b60529df5d 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -327,12 +327,14 @@ void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) { CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); ASSERT(pFormCtrl); - if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) { - UnderlyingPageType* pPage = pWidget->GetUnderlyingPage(); - m_pFormFillEnv->Invalidate( - pPage, formfiller->GetViewBBox( - m_pFormFillEnv->GetPageView(pPage, false), pWidget)); - } + CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl); + if (!pWidget) + continue; + + UnderlyingPageType* pPage = pWidget->GetUnderlyingPage(); + FX_RECT rect = formfiller->GetViewBBox( + m_pFormFillEnv->GetPageView(pPage, false), pWidget); + m_pFormFillEnv->Invalidate(pPage, rect); } } -- cgit v1.2.3