summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffline.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-21 22:03:20 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-21 22:03:20 +0000
commit559f974dbb92e35a1bfb739032d82a2536fcf59c (patch)
treef9b90f5029a28138377272195392aaab659250b1 /xfa/fxfa/cxfa_ffline.cpp
parent307dfb406422f9589fcdb09039b4c31a9c5f6269 (diff)
downloadpdfium-559f974dbb92e35a1bfb739032d82a2536fcf59c.tar.xz
Cleanup CXFA_StrokeData
This CL fixes return types and makes methods consts. Change-Id: I97da09a491d10760d6adf4efcc0557130cf8b405 Reviewed-on: https://pdfium-review.googlesource.com/19110 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffline.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffline.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/xfa/fxfa/cxfa_ffline.cpp b/xfa/fxfa/cxfa_ffline.cpp
index df83fa62ab..16794c35c5 100644
--- a/xfa/fxfa/cxfa_ffline.cpp
+++ b/xfa/fxfa/cxfa_ffline.cpp
@@ -10,6 +10,22 @@
#include "xfa/fxgraphics/cxfa_gepath.h"
#include "xfa/fxgraphics/cxfa_graphics.h"
+namespace {
+
+CFX_GraphStateData::LineCap LineCapToFXGE(XFA_ATTRIBUTEENUM iLineCap) {
+ switch (iLineCap) {
+ case XFA_ATTRIBUTEENUM_Round:
+ return CFX_GraphStateData::LineCapRound;
+ case XFA_ATTRIBUTEENUM_Butt:
+ return CFX_GraphStateData::LineCapButt;
+ default:
+ break;
+ }
+ return CFX_GraphStateData::LineCapSquare;
+}
+
+} // namespace
+
CXFA_FFLine::CXFA_FFLine(CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pDataAcc) {}
CXFA_FFLine::~CXFA_FFLine() {}
@@ -74,12 +90,12 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS,
CXFA_LineData lineData = valueData.GetLineData();
FX_ARGB lineColor = 0xFF000000;
- int32_t iStrokeType = 0;
float fLineWidth = 1.0f;
- int32_t iCap = 0;
+ XFA_ATTRIBUTEENUM iStrokeType = XFA_ATTRIBUTEENUM_Unknown;
+ XFA_ATTRIBUTEENUM iCap = XFA_ATTRIBUTEENUM_Unknown;
CXFA_EdgeData edgeData = lineData.GetEdgeData();
if (edgeData.HasValidNode()) {
- if (edgeData.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
+ if (!edgeData.IsVisible())
return;
lineColor = edgeData.GetColor();
@@ -107,8 +123,9 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS,
pGS->SetLineWidth(fLineWidth);
pGS->EnableActOnDash();
XFA_StrokeTypeSetLineDash(pGS, iStrokeType, iCap);
+
pGS->SetStrokeColor(CXFA_GEColor(lineColor));
- pGS->SetLineCap(XFA_LineCapToFXGE(iCap));
+ pGS->SetLineCap(LineCapToFXGE(iCap));
pGS->StrokePath(&linePath, &mtRotate);
pGS->RestoreGraphState();
}