summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-07-13 13:44:40 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-13 18:31:06 +0000
commit334e79e15c271aeccacd65376e0050725d79d79d (patch)
treee7a19aa140a8ec32b04268dee355944849d48f08 /fpdfsdk
parent3628f8b06e4518c81971782455270d5db4ff91c9 (diff)
downloadpdfium-334e79e15c271aeccacd65376e0050725d79d79d.tar.xz
Move CPWL_Utils::ScaleRect to CFX_FloatRect
This CL moves the ScaleRect method to Scale on CFX_FloatRect and changes it to operate directly on the rect. Change-Id: Ie0f91c9319be08c9e2cc81cba2519ebb5f2c35eb Reviewed-on: https://pdfium-review.googlesource.com/7714 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_utils.cpp36
-rw-r--r--fpdfsdk/pdfwindow/cpwl_utils.h2
2 files changed, 16 insertions, 22 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_utils.cpp b/fpdfsdk/pdfwindow/cpwl_utils.cpp
index 998c95c875..238abe7488 100644
--- a/fpdfsdk/pdfwindow/cpwl_utils.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_utils.cpp
@@ -218,18 +218,6 @@ CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CFX_FloatRect& crBBox,
return CFX_ByteString(csAP);
}
-CFX_FloatRect CPWL_Utils::ScaleRect(const CFX_FloatRect& rcRect, float fScale) {
- float fHalfWidth = (rcRect.right - rcRect.left) / 2.0f;
- float fHalfHeight = (rcRect.top - rcRect.bottom) / 2.0f;
-
- CFX_PointF ptCenter = CFX_PointF((rcRect.left + rcRect.right) / 2,
- (rcRect.top + rcRect.bottom) / 2);
-
- return CFX_FloatRect(
- ptCenter.x - fHalfWidth * fScale, ptCenter.y - fHalfHeight * fScale,
- ptCenter.x + fHalfWidth * fScale, ptCenter.y + fHalfHeight * fScale);
-}
-
CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CFX_FloatRect& rect,
const CPWL_Color& color) {
std::ostringstream sAppStream;
@@ -784,15 +772,19 @@ CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
case PCS_CHECK:
return GetAppStream_Check(rcCenter, crText);
case PCS_CIRCLE:
- return GetAppStream_Circle(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
+ rcCenter.Scale(2.0f / 3.0f);
+ return GetAppStream_Circle(rcCenter, crText);
case PCS_CROSS:
return GetAppStream_Cross(rcCenter, crText);
case PCS_DIAMOND:
- return GetAppStream_Diamond(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
+ rcCenter.Scale(2.0f / 3.0f);
+ return GetAppStream_Diamond(rcCenter, crText);
case PCS_SQUARE:
- return GetAppStream_Square(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
+ rcCenter.Scale(2.0f / 3.0f);
+ return GetAppStream_Square(rcCenter, crText);
case PCS_STAR:
- return GetAppStream_Star(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
+ rcCenter.Scale(2.0f / 3.0f);
+ return GetAppStream_Star(rcCenter, crText);
}
}
@@ -805,15 +797,19 @@ CFX_ByteString CPWL_Utils::GetRadioButtonAppStream(const CFX_FloatRect& rcBBox,
case PCS_CHECK:
return GetAppStream_Check(rcCenter, crText);
case PCS_CIRCLE:
- return GetAppStream_Circle(ScaleRect(rcCenter, 1.0f / 2.0f), crText);
+ rcCenter.Scale(1.0f / 2.0f);
+ return GetAppStream_Circle(rcCenter, crText);
case PCS_CROSS:
return GetAppStream_Cross(rcCenter, crText);
case PCS_DIAMOND:
- return GetAppStream_Diamond(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
+ rcCenter.Scale(2.0f / 3.0f);
+ return GetAppStream_Diamond(rcCenter, crText);
case PCS_SQUARE:
- return GetAppStream_Square(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
+ rcCenter.Scale(2.0f / 3.0f);
+ return GetAppStream_Square(rcCenter, crText);
case PCS_STAR:
- return GetAppStream_Star(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
+ rcCenter.Scale(2.0f / 3.0f);
+ return GetAppStream_Star(rcCenter, crText);
}
}
diff --git a/fpdfsdk/pdfwindow/cpwl_utils.h b/fpdfsdk/pdfwindow/cpwl_utils.h
index ec6188e2b9..8d2a47a34e 100644
--- a/fpdfsdk/pdfwindow/cpwl_utils.h
+++ b/fpdfsdk/pdfwindow/cpwl_utils.h
@@ -122,8 +122,6 @@ class CPWL_Utils {
int32_t nEndGray);
private:
- static CFX_FloatRect ScaleRect(const CFX_FloatRect& rcRect, float fScale);
-
static CFX_ByteString GetAppStream_Check(const CFX_FloatRect& rcBBox,
const CPWL_Color& crText);
static CFX_ByteString GetAppStream_Circle(const CFX_FloatRect& rcBBox,