From c37fa7d9c5c60ac407b46bfc2e7745afa0b2df85 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 17 Jan 2018 19:29:46 +0000 Subject: Move code related to stroke line dash to CXFA_Stroke This CL moves XFA_StrokeTypeSetLineDash into the CXFA_Stroke class and cleans up the unused CXFA_Graphics code for setting line dash values. Change-Id: If6db6c315571dbcea630bc32e0d05dae6c0f10be Reviewed-on: https://pdfium-review.googlesource.com/23114 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxgraphics/cxfa_graphics.cpp | 35 ++--------------------------------- xfa/fxgraphics/cxfa_graphics.h | 11 +---------- 2 files changed, 3 insertions(+), 43 deletions(-) (limited to 'xfa/fxgraphics') diff --git a/xfa/fxgraphics/cxfa_graphics.cpp b/xfa/fxgraphics/cxfa_graphics.cpp index 47517309b7..d1e2f35c7e 100644 --- a/xfa/fxgraphics/cxfa_graphics.cpp +++ b/xfa/fxgraphics/cxfa_graphics.cpp @@ -154,9 +154,9 @@ void CXFA_Graphics::SetLineDash(float dashPhase, } } -void CXFA_Graphics::SetLineDash(FX_DashStyle dashStyle) { +void CXFA_Graphics::SetSolidLineDash() { if (m_type == FX_CONTEXT_Device && m_renderDevice) - RenderDeviceSetLineDash(dashStyle); + m_info.graphState.SetDashCount(0); } void CXFA_Graphics::SetLineWidth(float lineWidth) { @@ -229,37 +229,6 @@ CFX_RenderDevice* CXFA_Graphics::GetRenderDevice() { return m_renderDevice; } -void CXFA_Graphics::RenderDeviceSetLineDash(FX_DashStyle dashStyle) { - switch (dashStyle) { - case FX_DASHSTYLE_Solid: { - m_info.graphState.SetDashCount(0); - return; - } - case FX_DASHSTYLE_Dash: { - float dashArray[] = {3, 1}; - SetLineDash(0, dashArray, 2); - return; - } - case FX_DASHSTYLE_Dot: { - float dashArray[] = {1, 1}; - SetLineDash(0, dashArray, 2); - return; - } - case FX_DASHSTYLE_DashDot: { - float dashArray[] = {3, 1, 1, 1}; - SetLineDash(0, dashArray, 4); - return; - } - case FX_DASHSTYLE_DashDotDot: { - float dashArray[] = {4, 1, 2, 1, 2, 1}; - SetLineDash(0, dashArray, 6); - return; - } - default: - return; - } -} - void CXFA_Graphics::RenderDeviceStrokePath(const CXFA_GEPath* path, const CFX_Matrix* matrix) { if (m_info.strokeColor.GetType() != CXFA_GEColor::Solid) diff --git a/xfa/fxgraphics/cxfa_graphics.h b/xfa/fxgraphics/cxfa_graphics.h index c8843bc87d..886bc45532 100644 --- a/xfa/fxgraphics/cxfa_graphics.h +++ b/xfa/fxgraphics/cxfa_graphics.h @@ -21,14 +21,6 @@ class CXFA_GEPath; using FX_FillMode = int32_t; -enum FX_DashStyle { - FX_DASHSTYLE_Solid = 0, - FX_DASHSTYLE_Dash = 1, - FX_DASHSTYLE_Dot = 2, - FX_DASHSTYLE_DashDot = 3, - FX_DASHSTYLE_DashDotDot = 4 -}; - enum class FX_HatchStyle { Horizontal = 0, Vertical = 1, @@ -54,7 +46,7 @@ class CXFA_Graphics { void SetLineCap(CFX_GraphStateData::LineCap lineCap); void SetLineDash(float dashPhase, float* dashArray, int32_t dashCount); - void SetLineDash(FX_DashStyle dashStyle); + void SetSolidLineDash(); void SetLineWidth(float lineWidth); void EnableActOnDash(); void SetStrokeColor(const CXFA_GEColor& color); @@ -82,7 +74,6 @@ class CXFA_Graphics { CXFA_GEColor fillColor; } m_info; - void RenderDeviceSetLineDash(FX_DashStyle dashStyle); void RenderDeviceStrokePath(const CXFA_GEPath* path, const CFX_Matrix* matrix); void RenderDeviceFillPath(const CXFA_GEPath* path, -- cgit v1.2.3