summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_widget.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-07-13 21:36:29 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-17 15:43:06 +0000
commitd6aff2f2e8469344becd6f73e443c31bca9baac0 (patch)
tree1e14517547352b92e66f5256652debb3341acec4 /fpdfsdk/cpdfsdk_widget.cpp
parent18531230381465592e1a037e6dfc39d4a6fb5def (diff)
downloadpdfium-d6aff2f2e8469344becd6f73e443c31bca9baac0.tar.xz
Add CFX_FloatRect::GetDeflated
This CL adds a method to CFX_FloatRect to get a new deflated rectangle from a given rectangle. Change-Id: I781222257c82baf94d5f77deede52fbe4e97c701 Reviewed-on: https://pdfium-review.googlesource.com/7850 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_widget.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp36
1 files changed, 5 insertions, 31 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index b0f3c3468b..80e7c8adb1 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -925,12 +925,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
break;
}
- CFX_FloatRect rcClient = rcWindow;
- if (!rcClient.IsEmpty()) {
- rcClient.Deflate(fBorderWidth, fBorderWidth);
- rcClient.Normalize();
- }
-
+ CFX_FloatRect rcClient = rcWindow.GetDeflated(fBorderWidth, fBorderWidth);
CFX_Color crText(COLORTYPE_GRAY, 0);
CFX_ByteString csNameTag;
@@ -1107,12 +1102,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
}
CFX_FloatRect rcWindow = GetRotatedRect();
- CFX_FloatRect rcClient = rcWindow;
- if (!rcClient.IsEmpty()) {
- rcClient.Deflate(fBorderWidth, fBorderWidth);
- rcClient.Normalize();
- }
-
+ CFX_FloatRect rcClient = rcWindow.GetDeflated(fBorderWidth, fBorderWidth);
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
da.GetColor(iColorType, fc);
@@ -1232,12 +1222,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
}
CFX_FloatRect rcWindow = GetRotatedRect();
- CFX_FloatRect rcClient = rcWindow;
- if (!rcClient.IsEmpty()) {
- rcClient.Deflate(fBorderWidth, fBorderWidth);
- rcClient.Normalize();
- }
-
+ CFX_FloatRect rcClient = rcWindow.GetDeflated(fBorderWidth, fBorderWidth);
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
da.GetColor(iColorType, fc);
@@ -1272,13 +1257,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
}
CFX_ByteString csAP_N_ON;
-
- CFX_FloatRect rcCenter = rcWindow.GetCenterSquare();
- if (!rcCenter.IsEmpty()) {
- rcCenter.Deflate(1.0f, 1.0f);
- rcCenter.Normalize();
- }
-
+ CFX_FloatRect rcCenter = rcWindow.GetCenterSquare().GetDeflated(1.0f, 1.0f);
if (nStyle == PCS_CIRCLE) {
if (nBorderStyle == BorderStyle::BEVELED) {
crLeftTop = CFX_Color(COLORTYPE_GRAY, 1);
@@ -1664,12 +1643,7 @@ CFX_FloatRect CPDFSDK_Widget::GetClientRect() const {
default:
break;
}
-
- if (!rcWindow.IsEmpty()) {
- rcWindow.Deflate(fBorderWidth, fBorderWidth);
- rcWindow.Normalize();
- }
- return rcWindow;
+ return rcWindow.GetDeflated(fBorderWidth, fBorderWidth);
}
CFX_FloatRect CPDFSDK_Widget::GetRotatedRect() const {