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 <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 27db105..b60529d 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -327,12 +327,14 @@
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);
}
}