summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/cpwl_utils.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-06-29 18:28:58 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-06-30 18:36:15 +0000
commitd24236a926deeb8b9589c330c27dbd300b7f8c9d (patch)
tree42c0258195c44d73699723abc433edefc6e62b8e /fpdfsdk/pdfwindow/cpwl_utils.cpp
parentf552ccab1d3ca232f9d2b4770ec40726e5047093 (diff)
downloadpdfium-d24236a926deeb8b9589c330c27dbd300b7f8c9d.tar.xz
Remove pointless CFX_FloatRect construction.
Also just call CFX_FloatRect() instead of explicitly writing out all zeros. Change-Id: I7574e64791d0c9ba613b14d0a613737dfbf39b12 Reviewed-on: https://pdfium-review.googlesource.com/7172 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/pdfwindow/cpwl_utils.cpp')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_utils.cpp46
1 files changed, 11 insertions, 35 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_utils.cpp b/fpdfsdk/pdfwindow/cpwl_utils.cpp
index ce263eff8b..4dd897d7d2 100644
--- a/fpdfsdk/pdfwindow/cpwl_utils.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_utils.cpp
@@ -353,22 +353,19 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
Icon.SetIconFit(&IconFit);
Icon.SetPDFStream(pIconStream);
- CFX_FloatRect rcLabel = CFX_FloatRect(0, 0, 0, 0);
- CFX_FloatRect rcIcon = CFX_FloatRect(0, 0, 0, 0);
+ CFX_FloatRect rcLabel;
+ CFX_FloatRect rcIcon;
float fWidth = 0.0f;
float fHeight = 0.0f;
switch (nLayOut) {
case PPBL_LABEL:
rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
break;
case PPBL_ICON:
rcIcon = rcBBox;
- rcLabel = CFX_FloatRect(0, 0, 0, 0);
break;
case PPBL_ICONTOPLABELBOTTOM:
-
if (pIconStream) {
if (IsFloatZero(fFontSize)) {
fHeight = rcBBox.top - rcBBox.bottom;
@@ -380,7 +377,6 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
fHeight = rcLabelContent.Height();
if (rcBBox.bottom + fHeight > rcBBox.top) {
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
rcLabel = rcBBox;
} else {
rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right,
@@ -391,12 +387,9 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
}
} else {
rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
}
-
break;
case PPBL_LABELTOPICONBOTTOM:
-
if (pIconStream) {
if (IsFloatZero(fFontSize)) {
fHeight = rcBBox.top - rcBBox.bottom;
@@ -409,7 +402,6 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
fHeight = rcLabelContent.Height();
if (rcBBox.bottom + fHeight > rcBBox.top) {
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
rcLabel = rcBBox;
} else {
rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.top - fHeight,
@@ -420,21 +412,17 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
}
} else {
rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
}
-
break;
case PPBL_ICONLEFTLABELRIGHT:
-
if (pIconStream) {
if (IsFloatZero(fFontSize)) {
fWidth = rcBBox.right - rcBBox.left;
- rcLabel = CFX_FloatRect(rcBBox.right - fWidth * fAutoFontScale,
- rcBBox.bottom, rcBBox.right, rcBBox.top);
- rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcLabel.left,
- rcBBox.top);
-
if (rcLabelContent.Width() < fWidth * fAutoFontScale) {
+ rcLabel = CFX_FloatRect(rcBBox.right - fWidth * fAutoFontScale,
+ rcBBox.bottom, rcBBox.right, rcBBox.top);
+ rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcLabel.left,
+ rcBBox.top);
} else {
if (rcLabelContent.Width() < fWidth) {
rcLabel = CFX_FloatRect(rcBBox.right - rcLabelContent.Width(),
@@ -443,15 +431,12 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
rcBBox.top);
} else {
rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
}
}
} else {
fWidth = rcLabelContent.Width();
-
if (rcBBox.left + fWidth > rcBBox.right) {
rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
} else {
rcLabel = CFX_FloatRect(rcBBox.right - fWidth, rcBBox.bottom,
rcBBox.right, rcBBox.top);
@@ -461,22 +446,18 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
}
} else {
rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
}
-
break;
case PPBL_LABELLEFTICONRIGHT:
-
if (pIconStream) {
if (IsFloatZero(fFontSize)) {
fWidth = rcBBox.right - rcBBox.left;
- rcLabel =
- CFX_FloatRect(rcBBox.left, rcBBox.bottom,
- rcBBox.left + fWidth * fAutoFontScale, rcBBox.top);
- rcIcon = CFX_FloatRect(rcLabel.right, rcBBox.bottom, rcBBox.right,
- rcBBox.top);
-
if (rcLabelContent.Width() < fWidth * fAutoFontScale) {
+ rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom,
+ rcBBox.left + fWidth * fAutoFontScale,
+ rcBBox.top);
+ rcIcon = CFX_FloatRect(rcLabel.right, rcBBox.bottom, rcBBox.right,
+ rcBBox.top);
} else {
if (rcLabelContent.Width() < fWidth) {
rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom,
@@ -486,15 +467,12 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
rcBBox.top);
} else {
rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
}
}
} else {
fWidth = rcLabelContent.Width();
-
if (rcBBox.left + fWidth > rcBBox.right) {
rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
} else {
rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom,
rcBBox.left + fWidth, rcBBox.top);
@@ -504,9 +482,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
}
} else {
rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
}
-
break;
case PPBL_LABELOVERICON:
rcLabel = rcBBox;