summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/cpwl_utils.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-07-13 13:39:34 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-13 17:55:25 +0000
commit469186a47d6ac939acbd80754ed9be5c085bdc22 (patch)
tree759d491eb8ab13a8e41a229b53f25c7bfccc30c1 /fpdfsdk/pdfwindow/cpwl_utils.cpp
parent8db114ab60439f6d598ec68aa629f4385a532a92 (diff)
downloadpdfium-469186a47d6ac939acbd80754ed9be5c085bdc22.tar.xz
Move CPWL_Utils::GetCenterSquare to CFX_FloatRect
This method is working on the FloatRect content so move it to CFX_FloatRect. Change-Id: I60aabf6e3b86aa9acc59f86cff69347ec5fe5033 Reviewed-on: https://pdfium-review.googlesource.com/7712 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.cpp17
1 files changed, 2 insertions, 15 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_utils.cpp b/fpdfsdk/pdfwindow/cpwl_utils.cpp
index 651f21e0b7..ed1a94542e 100644
--- a/fpdfsdk/pdfwindow/cpwl_utils.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_utils.cpp
@@ -264,19 +264,6 @@ CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CFX_FloatRect& rect,
return CFX_ByteString(sAppStream);
}
-CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) {
- float fWidth = rect.right - rect.left;
- float fHeight = rect.top - rect.bottom;
-
- float fCenterX = (rect.left + rect.right) / 2.0f;
- float fCenterY = (rect.top + rect.bottom) / 2.0f;
-
- float fRadius = (fWidth > fHeight) ? fHeight / 2 : fWidth / 2;
-
- return CFX_FloatRect(fCenterX - fRadius, fCenterY - fRadius,
- fCenterX + fRadius, fCenterY + fRadius);
-}
-
CFX_ByteString CPWL_Utils::GetEditAppStream(CFX_Edit* pEdit,
const CFX_PointF& ptOffset,
const CPVT_WordRange* pRange,
@@ -802,7 +789,7 @@ CFX_ByteString CPWL_Utils::GetAppStream_Star(const CFX_FloatRect& rcBBox,
CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
int32_t nStyle,
const CPWL_Color& crText) {
- CFX_FloatRect rcCenter = GetCenterSquare(rcBBox);
+ CFX_FloatRect rcCenter = rcBBox.GetCenterSquare();
switch (nStyle) {
default:
case PCS_CHECK:
@@ -823,7 +810,7 @@ CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
CFX_ByteString CPWL_Utils::GetRadioButtonAppStream(const CFX_FloatRect& rcBBox,
int32_t nStyle,
const CPWL_Color& crText) {
- CFX_FloatRect rcCenter = GetCenterSquare(rcBBox);
+ CFX_FloatRect rcCenter = rcBBox.GetCenterSquare();
switch (nStyle) {
default:
case PCS_CHECK: