summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/cpwl_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pdfwindow/cpwl_utils.cpp')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_utils.cpp36
1 files changed, 16 insertions, 20 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);
}
}