summaryrefslogtreecommitdiff
path: root/fpdfsdk/pwl
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pwl')
-rw-r--r--fpdfsdk/pwl/cpwl_combo_box.cpp30
-rw-r--r--fpdfsdk/pwl/cpwl_scroll_bar.cpp30
2 files changed, 33 insertions, 27 deletions
diff --git a/fpdfsdk/pwl/cpwl_combo_box.cpp b/fpdfsdk/pwl/cpwl_combo_box.cpp
index 67d2d88f50..3adbebcadb 100644
--- a/fpdfsdk/pwl/cpwl_combo_box.cpp
+++ b/fpdfsdk/pwl/cpwl_combo_box.cpp
@@ -20,8 +20,8 @@
namespace {
-constexpr float kDefaultFontSize = 12.0f;
-constexpr float kTriangleHalfLength = 3.0f;
+constexpr float kComboBoxDefaultFontSize = 12.0f;
+constexpr float kComboBoxTriangleHalfLength = 3.0f;
constexpr int kDefaultButtonWidth = 13;
} // namespace
@@ -105,14 +105,18 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_PointF ptCenter = GetCenterPoint();
- CFX_PointF pt1(ptCenter.x - kTriangleHalfLength,
- ptCenter.y + kTriangleHalfLength * 0.5f);
- CFX_PointF pt2(ptCenter.x + kTriangleHalfLength,
- ptCenter.y + kTriangleHalfLength * 0.5f);
- CFX_PointF pt3(ptCenter.x, ptCenter.y - kTriangleHalfLength * 0.5f);
-
- if (IsFloatBigger(rectWnd.right - rectWnd.left, kTriangleHalfLength * 2) &&
- IsFloatBigger(rectWnd.top - rectWnd.bottom, kTriangleHalfLength)) {
+ static constexpr float kComboBoxTriangleQuarterLength =
+ kComboBoxTriangleHalfLength * 0.5;
+ CFX_PointF pt1(ptCenter.x - kComboBoxTriangleHalfLength,
+ ptCenter.y + kComboBoxTriangleQuarterLength);
+ CFX_PointF pt2(ptCenter.x + kComboBoxTriangleHalfLength,
+ ptCenter.y + kComboBoxTriangleQuarterLength);
+ CFX_PointF pt3(ptCenter.x, ptCenter.y - kComboBoxTriangleQuarterLength);
+
+ if (IsFloatBigger(rectWnd.right - rectWnd.left,
+ kComboBoxTriangleHalfLength * 2) &&
+ IsFloatBigger(rectWnd.top - rectWnd.bottom,
+ kComboBoxTriangleHalfLength)) {
CFX_PathData path;
path.AppendPoint(pt1, FXPT_TYPE::MoveTo, false);
path.AppendPoint(pt2, FXPT_TYPE::LineTo, false);
@@ -304,10 +308,8 @@ void CPWL_ComboBox::CreateListBox(const CreateParams& cp) {
lcp.eCursorType = FXCT_ARROW;
lcp.rcRectWnd = CFX_FloatRect();
- if (cp.dwFlags & PWS_AUTOFONTSIZE)
- lcp.fFontSize = kDefaultFontSize;
- else
- lcp.fFontSize = cp.fFontSize;
+ lcp.fFontSize =
+ (cp.dwFlags & PWS_AUTOFONTSIZE) ? kComboBoxDefaultFontSize : cp.fFontSize;
if (cp.sBorderColor.nColorType == CFX_Color::kTransparent)
lcp.sBorderColor = PWL_DEFAULT_BLACKCOLOR;
diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.cpp b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
index 3ec936730e..65a51e37e8 100644
--- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
@@ -18,7 +18,7 @@ namespace {
constexpr float kButtonWidth = 9.0f;
constexpr float kPosButtonMinWidth = 2.0f;
-constexpr float kTriangleHalfLength = 2.0f;
+constexpr float kScrollBarTriangleHalfLength = 2.0f;
} // namespace
@@ -153,22 +153,26 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_PointF pt1;
CFX_PointF pt2;
CFX_PointF pt3;
+ static constexpr float kScrollBarTriangleQuarterLength =
+ kScrollBarTriangleHalfLength * 0.5;
if (m_eSBButtonType == PSBT_MIN) {
- pt1 = CFX_PointF(ptCenter.x - kTriangleHalfLength * 0.5f, ptCenter.y);
- pt2 = CFX_PointF(ptCenter.x + kTriangleHalfLength * 0.5f,
- ptCenter.y + kTriangleHalfLength);
- pt3 = CFX_PointF(ptCenter.x + kTriangleHalfLength * 0.5f,
- ptCenter.y - kTriangleHalfLength);
+ pt1 =
+ CFX_PointF(ptCenter.x - kScrollBarTriangleQuarterLength, ptCenter.y);
+ pt2 = CFX_PointF(ptCenter.x + kScrollBarTriangleQuarterLength,
+ ptCenter.y + kScrollBarTriangleHalfLength);
+ pt3 = CFX_PointF(ptCenter.x + kScrollBarTriangleQuarterLength,
+ ptCenter.y - kScrollBarTriangleHalfLength);
} else if (m_eSBButtonType == PSBT_MAX) {
- pt1 = CFX_PointF(ptCenter.x + kTriangleHalfLength * 0.5f, ptCenter.y);
- pt2 = CFX_PointF(ptCenter.x - kTriangleHalfLength * 0.5f,
- ptCenter.y + kTriangleHalfLength);
- pt3 = CFX_PointF(ptCenter.x - kTriangleHalfLength * 0.5f,
- ptCenter.y - kTriangleHalfLength);
+ pt1 =
+ CFX_PointF(ptCenter.x + kScrollBarTriangleQuarterLength, ptCenter.y);
+ pt2 = CFX_PointF(ptCenter.x - kScrollBarTriangleQuarterLength,
+ ptCenter.y + kScrollBarTriangleHalfLength);
+ pt3 = CFX_PointF(ptCenter.x - kScrollBarTriangleQuarterLength,
+ ptCenter.y - kScrollBarTriangleHalfLength);
}
- if (rectWnd.right - rectWnd.left > kTriangleHalfLength * 2 &&
- rectWnd.top - rectWnd.bottom > kTriangleHalfLength) {
+ if (rectWnd.right - rectWnd.left > kScrollBarTriangleHalfLength * 2 &&
+ rectWnd.top - rectWnd.bottom > kScrollBarTriangleHalfLength) {
CFX_PathData path;
path.AppendPoint(pt1, FXPT_TYPE::MoveTo, false);
path.AppendPoint(pt2, FXPT_TYPE::LineTo, false);