Remove boolean args from CFX_RenderDevice::DrawShadow().
There is but one caller that passes constant values. Then remove
unreachable code.
Change-Id: Iaca070c08101118c4962a1fda64dc1ab9908e85e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/92195
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index b6d116f..efacb43 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -1311,8 +1311,6 @@
}
void CFX_RenderDevice::DrawShadow(const CFX_Matrix& mtUser2Device,
- bool bVertical,
- bool bHorizontal,
const CFX_FloatRect& rect,
int32_t nTransparency,
int32_t nStartGray,
@@ -1321,34 +1319,17 @@
constexpr float kSegmentWidth = 1.0f;
constexpr float kLineWidth = 1.5f;
- if (bVertical) {
- float fStepGray = (nEndGray - nStartGray) / rect.Height();
- CFX_PointF start(rect.left, 0);
- CFX_PointF end(rect.right, 0);
+ float fStepGray = (nEndGray - nStartGray) / rect.Height();
+ CFX_PointF start(rect.left, 0);
+ CFX_PointF end(rect.right, 0);
- for (float fy = rect.bottom + kBorder; fy <= rect.top - kBorder;
- fy += kSegmentWidth) {
- start.y = fy;
- end.y = fy;
- int nGray = nStartGray + static_cast<int>(fStepGray * (fy - rect.bottom));
- FX_ARGB color = ArgbEncode(nTransparency, nGray, nGray, nGray);
- DrawStrokeLine(&mtUser2Device, start, end, color, kLineWidth);
- }
- }
-
- if (bHorizontal) {
- float fStepGray = (nEndGray - nStartGray) / rect.Width();
- CFX_PointF start(0, rect.bottom);
- CFX_PointF end(0, rect.top);
-
- for (float fx = rect.left + kBorder; fx <= rect.right - kBorder;
- fx += kSegmentWidth) {
- start.x = fx;
- end.x = fx;
- int nGray = nStartGray + static_cast<int>(fStepGray * (fx - rect.left));
- FX_ARGB color = ArgbEncode(nTransparency, nGray, nGray, nGray);
- DrawStrokeLine(&mtUser2Device, start, end, color, kLineWidth);
- }
+ for (float fy = rect.bottom + kBorder; fy <= rect.top - kBorder;
+ fy += kSegmentWidth) {
+ start.y = fy;
+ end.y = fy;
+ int nGray = nStartGray + static_cast<int>(fStepGray * (fy - rect.bottom));
+ FX_ARGB color = ArgbEncode(nTransparency, nGray, nGray, nGray);
+ DrawStrokeLine(&mtUser2Device, start, end, color, kLineWidth);
}
}
diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h
index b8660aa..0076b2f 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -202,8 +202,6 @@
const std::vector<CFX_PointF>& points,
const FX_COLORREF& color);
void DrawShadow(const CFX_Matrix& mtUser2Device,
- bool bVertical,
- bool bHorizontal,
const CFX_FloatRect& rect,
int32_t nTransparency,
int32_t nStartGray,
diff --git a/fpdfsdk/pwl/cpwl_sbbutton.cpp b/fpdfsdk/pwl/cpwl_sbbutton.cpp
index 6af47a3..68e52c6 100644
--- a/fpdfsdk/pwl/cpwl_sbbutton.cpp
+++ b/fpdfsdk/pwl/cpwl_sbbutton.cpp
@@ -42,9 +42,8 @@
if (m_eSBButtonType != Type::kPosButton) {
// draw background
- pDevice->DrawShadow(mtUser2Device, true, false,
- rectWnd.GetDeflated(1.0f, 1.0f), nTransparency, 80,
- 220);
+ pDevice->DrawShadow(mtUser2Device, rectWnd.GetDeflated(1.0f, 1.0f),
+ nTransparency, 80, 220);
// draw arrow
if (rectWnd.top - rectWnd.bottom > 6.0f) {
float fX = rectWnd.left + 1.5f;