summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_widget.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-07-12 21:56:27 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-13 17:11:16 +0000
commitadf922f278d23e7f955b89f48cc64b5de7925977 (patch)
tree1cae79929399b712938d88480d90ebc2c7ea59ff /fpdfsdk/cpdfsdk_widget.cpp
parenta860a3d596f3daeadfdca0cc2093bfca722fa3a3 (diff)
downloadpdfium-adf922f278d23e7f955b89f48cc64b5de7925977.tar.xz
Remove CPWL_Utils::{In,De}flateRect
This CL removes the custom InflateRect and Deflate rect code in CPWL_Utils in favour of calling the CFX_FloatRect version. This required inlining some extra code at each callsite to check the rect size and normalize. Change-Id: I7f60e5de03fc1db0c1d8e51eaa1d0e0700ebf157 Reviewed-on: https://pdfium-review.googlesource.com/7710 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_widget.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 6670b29002..b7391e6ebc 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -925,7 +925,11 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
break;
}
- CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
+ CFX_FloatRect rcClient = rcWindow;
+ if (!rcClient.IsEmpty()) {
+ rcClient.Deflate(fBorderWidth, fBorderWidth);
+ rcClient.Normalize();
+ }
CPWL_Color crText(COLORTYPE_GRAY, 0);
@@ -1103,7 +1107,12 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
}
CFX_FloatRect rcWindow = GetRotatedRect();
- CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
+ CFX_FloatRect rcClient = rcWindow;
+ if (!rcClient.IsEmpty()) {
+ rcClient.Deflate(fBorderWidth, fBorderWidth);
+ rcClient.Normalize();
+ }
+
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
da.GetColor(iColorType, fc);
@@ -1223,7 +1232,11 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
}
CFX_FloatRect rcWindow = GetRotatedRect();
- CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
+ CFX_FloatRect rcClient = rcWindow;
+ if (!rcClient.IsEmpty()) {
+ rcClient.Deflate(fBorderWidth, fBorderWidth);
+ rcClient.Normalize();
+ }
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
@@ -1260,8 +1273,11 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
CFX_ByteString csAP_N_ON;
- CFX_FloatRect rcCenter =
- CPWL_Utils::DeflateRect(CPWL_Utils::GetCenterSquare(rcWindow), 1.0f);
+ CFX_FloatRect rcCenter = CPWL_Utils::GetCenterSquare(rcWindow);
+ if (!rcCenter.IsEmpty()) {
+ rcCenter.Deflate(1.0f, 1.0f);
+ rcCenter.Normalize();
+ }
if (nStyle == PCS_CIRCLE) {
if (nBorderStyle == BorderStyle::BEVELED) {
@@ -1651,7 +1667,11 @@ CFX_FloatRect CPDFSDK_Widget::GetClientRect() const {
break;
}
- return CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
+ if (!rcWindow.IsEmpty()) {
+ rcWindow.Deflate(fBorderWidth, fBorderWidth);
+ rcWindow.Normalize();
+ }
+ return rcWindow;
}
CFX_FloatRect CPDFSDK_Widget::GetRotatedRect() const {