summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_stroke.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-17 19:29:46 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-17 19:29:46 +0000
commitc37fa7d9c5c60ac407b46bfc2e7745afa0b2df85 (patch)
treeacca98967c4e532732ef9b15a399b2dc710e01e5 /xfa/fxfa/parser/cxfa_stroke.cpp
parentdcc2f3cf96fd20782c32ae03629427fb93b219b2 (diff)
downloadpdfium-c37fa7d9c5c60ac407b46bfc2e7745afa0b2df85.tar.xz
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 <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_stroke.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_stroke.cpp45
1 files changed, 45 insertions, 0 deletions
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,