summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/cpwl_utils.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/pdfwindow/cpwl_utils.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/pdfwindow/cpwl_utils.cpp')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_utils.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_utils.cpp b/fpdfsdk/pdfwindow/cpwl_utils.cpp
index c576044a69..af69174276 100644
--- a/fpdfsdk/pdfwindow/cpwl_utils.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_utils.cpp
@@ -611,19 +611,10 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(
sAppStream << "q\n";
float fHalfWidth = fWidth / 2.0f;
+ CFX_FloatRect rect_by_2 = rect.GetDeflated(fHalfWidth, fHalfWidth);
- CFX_FloatRect rect_by_2 = rect;
- CFX_FloatRect rect_by_75 = rect;
- if (!rect.IsEmpty()) {
- float div = fWidth / 2.0f;
- rect_by_2.Deflate(div, div);
- rect_by_2.Normalize();
-
- div = fHalfWidth * 0.75f;
- rect_by_75.Deflate(div, div);
- rect_by_75.Normalize();
- }
-
+ float div = fHalfWidth * 0.75f;
+ CFX_FloatRect rect_by_75 = rect.GetDeflated(div, div);
switch (nStyle) {
default:
case BorderStyle::SOLID: