summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp46
-rw-r--r--xfa/fxfa/cxfa_ffwidget.h3
-rw-r--r--xfa/fxfa/parser/cxfa_stroke.cpp45
-rw-r--r--xfa/fxfa/parser/cxfa_stroke.h4
-rw-r--r--xfa/fxgraphics/cxfa_graphics.cpp35
-rw-r--r--xfa/fxgraphics/cxfa_graphics.h11
6 files changed, 52 insertions, 92 deletions
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index 4836e04811..8df7ff7782 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -70,52 +70,6 @@ bool IsFXCodecErrorStatus(FXCODEC_STATUS status) {
} // namespace
-int32_t XFA_StrokeTypeSetLineDash(CXFA_Graphics* pGraphics,
- XFA_AttributeEnum iStrokeType,
- XFA_AttributeEnum iCapType) {
- switch (iStrokeType) {
- case XFA_AttributeEnum::DashDot: {
- float dashArray[] = {4, 1, 2, 1};
- if (iCapType != XFA_AttributeEnum::Butt) {
- dashArray[1] = 2;
- dashArray[3] = 2;
- }
- pGraphics->SetLineDash(0, dashArray, 4);
- return FX_DASHSTYLE_DashDot;
- }
- case XFA_AttributeEnum::DashDotDot: {
- float dashArray[] = {4, 1, 2, 1, 2, 1};
- if (iCapType != XFA_AttributeEnum::Butt) {
- dashArray[1] = 2;
- dashArray[3] = 2;
- dashArray[5] = 2;
- }
- pGraphics->SetLineDash(0, dashArray, 6);
- return FX_DASHSTYLE_DashDotDot;
- }
- case XFA_AttributeEnum::Dashed: {
- float dashArray[] = {5, 1};
- if (iCapType != XFA_AttributeEnum::Butt)
- dashArray[1] = 2;
-
- pGraphics->SetLineDash(0, dashArray, 2);
- return FX_DASHSTYLE_Dash;
- }
- case XFA_AttributeEnum::Dotted: {
- float dashArray[] = {2, 1};
- if (iCapType != XFA_AttributeEnum::Butt)
- dashArray[1] = 2;
-
- pGraphics->SetLineDash(0, dashArray, 2);
- return FX_DASHSTYLE_Dot;
- }
- default:
- break;
- }
- pGraphics->SetLineDash(FX_DASHSTYLE_Solid);
- return FX_DASHSTYLE_Solid;
-}
-
void XFA_DrawImage(CXFA_Graphics* pGS,
const CFX_RectF& rtImage,
const CFX_Matrix& matrix,
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index 192f559fd4..aa913cca99 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -31,9 +31,6 @@ inline float XFA_UnitPx2Pt(float fPx, float fDpi) {
#define XFA_FLOAT_PERCISION 0.001f
-int32_t XFA_StrokeTypeSetLineDash(CXFA_Graphics* pGraphics,
- XFA_AttributeEnum iStrokeType,
- XFA_AttributeEnum iCapType);
void XFA_DrawImage(CXFA_Graphics* pGS,
const CFX_RectF& rtImage,
const CFX_Matrix& matrix,
diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_stroke.cpp
index 45634b26e3..c581a96303 100644
--- a/xfa/fxfa/parser/cxfa_stroke.cpp
+++ b/xfa/fxfa/parser/cxfa_stroke.cpp
@@ -15,6 +15,51 @@
#include "xfa/fxfa/parser/xfa_utils.h"
#include "xfa/fxgraphics/cxfa_graphics.h"
+void XFA_StrokeTypeSetLineDash(CXFA_Graphics* pGraphics,
+ XFA_AttributeEnum iStrokeType,
+ XFA_AttributeEnum iCapType) {
+ switch (iStrokeType) {
+ case XFA_AttributeEnum::DashDot: {
+ float dashArray[] = {4, 1, 2, 1};
+ if (iCapType != XFA_AttributeEnum::Butt) {
+ dashArray[1] = 2;
+ dashArray[3] = 2;
+ }
+ pGraphics->SetLineDash(0, dashArray, 4);
+ break;
+ }
+ case XFA_AttributeEnum::DashDotDot: {
+ float dashArray[] = {4, 1, 2, 1, 2, 1};
+ if (iCapType != XFA_AttributeEnum::Butt) {
+ dashArray[1] = 2;
+ dashArray[3] = 2;
+ dashArray[5] = 2;
+ }
+ pGraphics->SetLineDash(0, dashArray, 6);
+ break;
+ }
+ case XFA_AttributeEnum::Dashed: {
+ float dashArray[] = {5, 1};
+ if (iCapType != XFA_AttributeEnum::Butt)
+ dashArray[1] = 2;
+
+ pGraphics->SetLineDash(0, dashArray, 2);
+ break;
+ }
+ case XFA_AttributeEnum::Dotted: {
+ float dashArray[] = {2, 1};
+ if (iCapType != XFA_AttributeEnum::Butt)
+ dashArray[1] = 2;
+
+ pGraphics->SetLineDash(0, dashArray, 2);
+ break;
+ }
+ default:
+ pGraphics->SetSolidLineDash();
+ break;
+ }
+}
+
CXFA_Stroke::CXFA_Stroke(CXFA_Document* pDoc,
XFA_PacketType ePacket,
uint32_t validPackets,
diff --git a/xfa/fxfa/parser/cxfa_stroke.h b/xfa/fxfa/parser/cxfa_stroke.h
index d3eeff1ed2..ed41997073 100644
--- a/xfa/fxfa/parser/cxfa_stroke.h
+++ b/xfa/fxfa/parser/cxfa_stroke.h
@@ -22,6 +22,10 @@ class CXFA_GEPath;
class CXFA_Graphics;
class CXFA_Node;
+void XFA_StrokeTypeSetLineDash(CXFA_Graphics* pGraphics,
+ XFA_AttributeEnum iStrokeType,
+ XFA_AttributeEnum iCapType);
+
class CXFA_Stroke : public CXFA_Node {
public:
~CXFA_Stroke() override;
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,