summaryrefslogtreecommitdiff
path: root/xfa/fxgraphics/cxfa_graphics.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-20 19:10:17 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-20 19:10:17 +0000
commit9273e0674ecf87929696ca89cbf16371edabc315 (patch)
tree1b26f0c638a7252e8b1dfc961c6ec09d50fb546b /xfa/fxgraphics/cxfa_graphics.cpp
parentf6144d4ab76e6357bd8d228ddf542ef4fb3fa3b0 (diff)
downloadpdfium-9273e0674ecf87929696ca89cbf16371edabc315.tar.xz
Clean up CXFA_Graphics::SetLineDash().
Fix some nits in CXFA_FFField as well. Change-Id: I6d0d4569322a01192cdd4bf9d98325ff86642abe Reviewed-on: https://pdfium-review.googlesource.com/40651 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fxgraphics/cxfa_graphics.cpp')
-rw-r--r--xfa/fxgraphics/cxfa_graphics.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/xfa/fxgraphics/cxfa_graphics.cpp b/xfa/fxgraphics/cxfa_graphics.cpp
index ae1e04acca..47e4b6b98f 100644
--- a/xfa/fxgraphics/cxfa_graphics.cpp
+++ b/xfa/fxgraphics/cxfa_graphics.cpp
@@ -135,23 +135,19 @@ void CXFA_Graphics::SetLineCap(CFX_GraphStateData::LineCap lineCap) {
}
void CXFA_Graphics::SetLineDash(float dashPhase,
- float* dashArray,
- int32_t dashCount) {
- if (dashCount > 0 && !dashArray)
+ const float* dashArray,
+ size_t dashCount) {
+ ASSERT(dashArray);
+ ASSERT(dashCount);
+
+ if (m_type != FX_CONTEXT_Device || !m_renderDevice)
return;
- dashCount = dashCount < 0 ? 0 : dashCount;
- if (m_type == FX_CONTEXT_Device && m_renderDevice) {
- float scale = 1.0;
- if (m_info.isActOnDash) {
- scale = m_info.graphState.m_LineWidth;
- }
- m_info.graphState.m_DashPhase = dashPhase;
- m_info.graphState.SetDashCount(dashCount);
- for (int32_t i = 0; i < dashCount; i++) {
- m_info.graphState.m_DashArray[i] = dashArray[i] * scale;
- }
- }
+ float scale = m_info.isActOnDash ? m_info.graphState.m_LineWidth : 1.0;
+ m_info.graphState.m_DashPhase = dashPhase;
+ m_info.graphState.SetDashCount(dashCount);
+ for (size_t i = 0; i < dashCount; i++)
+ m_info.graphState.m_DashArray[i] = dashArray[i] * scale;
}
void CXFA_Graphics::SetSolidLineDash() {