summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/cxfa_ffline.cpp25
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp36
-rw-r--r--xfa/fxfa/cxfa_ffwidget.h5
-rw-r--r--xfa/fxfa/parser/cxfa_boxdata.cpp3
-rw-r--r--xfa/fxfa/parser/cxfa_strokedata.cpp13
-rw-r--r--xfa/fxfa/parser/cxfa_strokedata.h20
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp2
7 files changed, 58 insertions, 46 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();
}
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index a5d19f05ac..7847bea982 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -90,9 +90,9 @@ void XFA_BOX_GetPath(const std::vector<CXFA_StrokeData>& strokes,
CXFA_StrokeData strokeBeforeData = strokes[(nIndex + 1 * 8 - 1) % 8];
CXFA_StrokeData strokeAfterData = strokes[nIndex + 1];
if (strokeData.IsInverted()) {
- if (!strokeData.SameStyles(strokeBeforeData))
+ if (!strokeData.SameStyles(strokeBeforeData, 0))
halfBefore = strokeBeforeData.GetThickness() / 2;
- if (!strokeData.SameStyles(strokeAfterData))
+ if (!strokeData.SameStyles(strokeAfterData, 0))
halfAfter = strokeAfterData.GetThickness() / 2;
}
} else {
@@ -257,7 +257,7 @@ void XFA_BOX_GetFillPath(const CXFA_BoxData& boxData,
CXFA_StrokeData strokeData1 = strokes[0];
for (int32_t i = 1; i < 8; i++) {
CXFA_StrokeData strokeData2 = strokes[i];
- if (!strokeData1.SameStyles(strokeData2)) {
+ if (!strokeData1.SameStyles(strokeData2, 0)) {
bSameStyles = false;
break;
}
@@ -754,7 +754,7 @@ void XFA_BOX_Stroke_Rect(CXFA_BoxData boxData,
CXFA_StrokeData strokeData1 = strokes[0];
for (int32_t i = 1; i < 8; i++) {
CXFA_StrokeData strokeData2 = strokes[i];
- if (!strokeData1.SameStyles(strokeData2)) {
+ if (!strokeData1.SameStyles(strokeData2, 0)) {
bSameStyles = false;
break;
}
@@ -795,7 +795,7 @@ void XFA_BOX_Stroke_Rect(CXFA_BoxData boxData,
continue;
}
XFA_BOX_GetPath(strokes, rtWidget, path, i, bStart, !bSameStyles);
- bStart = !strokeData.SameStyles(strokes[(i + 1) % 8]);
+ bStart = !strokeData.SameStyles(strokes[(i + 1) % 8], 0);
if (bStart) {
XFA_BOX_StrokePath(strokeData, &path, pGS, matrix);
path.Clear();
@@ -1334,16 +1334,19 @@ void CXFA_FFWidget::EventKillFocus() {
eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Exit, &eParam);
}
+
bool CXFA_FFWidget::IsButtonDown() {
return (m_dwStatus & XFA_WidgetStatus_ButtonDown) != 0;
}
+
void CXFA_FFWidget::SetButtonDown(bool bSet) {
bSet ? m_dwStatus |= XFA_WidgetStatus_ButtonDown
: m_dwStatus &= ~XFA_WidgetStatus_ButtonDown;
}
+
int32_t XFA_StrokeTypeSetLineDash(CXFA_Graphics* pGraphics,
- int32_t iStrokeType,
- int32_t iCapType) {
+ XFA_ATTRIBUTEENUM iStrokeType,
+ XFA_ATTRIBUTEENUM iCapType) {
switch (iStrokeType) {
case XFA_ATTRIBUTEENUM_DashDot: {
float dashArray[] = {4, 1, 2, 1};
@@ -1366,17 +1369,17 @@ int32_t XFA_StrokeTypeSetLineDash(CXFA_Graphics* pGraphics,
}
case XFA_ATTRIBUTEENUM_Dashed: {
float dashArray[] = {5, 1};
- if (iCapType != XFA_ATTRIBUTEENUM_Butt) {
+ 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) {
+ if (iCapType != XFA_ATTRIBUTEENUM_Butt)
dashArray[1] = 2;
- }
+
pGraphics->SetLineDash(0, dashArray, 2);
return FX_DASHSTYLE_Dot;
}
@@ -1386,17 +1389,6 @@ int32_t XFA_StrokeTypeSetLineDash(CXFA_Graphics* pGraphics,
pGraphics->SetLineDash(FX_DASHSTYLE_Solid);
return FX_DASHSTYLE_Solid;
}
-CFX_GraphStateData::LineCap XFA_LineCapToFXGE(int32_t 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;
-}
class CXFA_ImageRenderer {
public:
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index 5729654a2b..4e9863cb5c 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -35,9 +35,8 @@ enum XFA_WIDGETITEM {
};
int32_t XFA_StrokeTypeSetLineDash(CXFA_Graphics* pGraphics,
- int32_t iStrokeType,
- int32_t iCapType);
-CFX_GraphStateData::LineCap XFA_LineCapToFXGE(int32_t iLineCap);
+ 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_boxdata.cpp b/xfa/fxfa/parser/cxfa_boxdata.cpp
index a9f7ace13e..ef9864f6f9 100644
--- a/xfa/fxfa/parser/cxfa_boxdata.cpp
+++ b/xfa/fxfa/parser/cxfa_boxdata.cpp
@@ -63,7 +63,8 @@ static int32_t Style3D(const std::vector<CXFA_StrokeData>& strokes,
strokeData = find;
break;
}
- int32_t iType = strokeData.GetStrokeType();
+
+ XFA_ATTRIBUTEENUM iType = strokeData.GetStrokeType();
if (iType == XFA_ATTRIBUTEENUM_Lowered || iType == XFA_ATTRIBUTEENUM_Raised ||
iType == XFA_ATTRIBUTEENUM_Etched ||
iType == XFA_ATTRIBUTEENUM_Embossed) {
diff --git a/xfa/fxfa/parser/cxfa_strokedata.cpp b/xfa/fxfa/parser/cxfa_strokedata.cpp
index edbac24237..0845719c9e 100644
--- a/xfa/fxfa/parser/cxfa_strokedata.cpp
+++ b/xfa/fxfa/parser/cxfa_strokedata.cpp
@@ -10,18 +10,19 @@
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/xfa_utils.h"
-int32_t CXFA_StrokeData::GetPresence() const {
- return m_pNode ? m_pNode->JSNode()->GetEnum(XFA_Attribute::Presence)
- : XFA_ATTRIBUTEENUM_Invisible;
+bool CXFA_StrokeData::IsVisible() const {
+ return m_pNode ? m_pNode->JSNode()->GetEnum(XFA_Attribute::Presence) ==
+ XFA_ATTRIBUTEENUM_Visible
+ : false;
}
-int32_t CXFA_StrokeData::GetCapType() const {
+XFA_ATTRIBUTEENUM CXFA_StrokeData::GetCapType() const {
if (!m_pNode)
return XFA_ATTRIBUTEENUM_Square;
return m_pNode->JSNode()->GetEnum(XFA_Attribute::Cap);
}
-int32_t CXFA_StrokeData::GetStrokeType() const {
+XFA_ATTRIBUTEENUM CXFA_StrokeData::GetStrokeType() const {
return m_pNode ? m_pNode->JSNode()->GetEnum(XFA_Attribute::Stroke)
: XFA_ATTRIBUTEENUM_Solid;
}
@@ -70,7 +71,7 @@ void CXFA_StrokeData::SetColor(FX_ARGB argb) {
false);
}
-int32_t CXFA_StrokeData::GetJoinType() const {
+XFA_ATTRIBUTEENUM CXFA_StrokeData::GetJoinType() const {
return m_pNode ? m_pNode->JSNode()->GetEnum(XFA_Attribute::Join)
: XFA_ATTRIBUTEENUM_Square;
}
diff --git a/xfa/fxfa/parser/cxfa_strokedata.h b/xfa/fxfa/parser/cxfa_strokedata.h
index 2921f885ff..b701c25edf 100644
--- a/xfa/fxfa/parser/cxfa_strokedata.h
+++ b/xfa/fxfa/parser/cxfa_strokedata.h
@@ -25,20 +25,22 @@ class CXFA_StrokeData : public CXFA_DataData {
explicit CXFA_StrokeData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}
bool IsCorner() const { return GetElementType() == XFA_Element::Corner; }
- bool IsEdge() const { return GetElementType() == XFA_Element::Edge; }
- bool IsVisible() const { return GetPresence() == XFA_ATTRIBUTEENUM_Visible; }
- int32_t GetPresence() const;
- int32_t GetCapType() const;
- int32_t GetStrokeType() const;
+ bool IsVisible() const;
+ bool IsInverted() const;
+
+ XFA_ATTRIBUTEENUM GetCapType() const;
+ XFA_ATTRIBUTEENUM GetStrokeType() const;
+ XFA_ATTRIBUTEENUM GetJoinType() const;
+ float GetRadius() const;
float GetThickness() const;
+
CXFA_Measurement GetMSThickness() const;
void SetMSThickness(CXFA_Measurement msThinkness);
+
FX_ARGB GetColor() const;
void SetColor(FX_ARGB argb);
- int32_t GetJoinType() const;
- bool IsInverted() const;
- float GetRadius() const;
- bool SameStyles(CXFA_StrokeData stroke, uint32_t dwFlags = 0) const;
+
+ bool SameStyles(CXFA_StrokeData stroke, uint32_t dwFlags) const;
};
#endif // XFA_FXFA_PARSER_CXFA_STROKEDATA_H_
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 4688aee390..13b1c7a3ae 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -25,7 +25,7 @@ float GetEdgeThickness(const std::vector<CXFA_StrokeData>& strokes,
int32_t nIndex) {
float fThickness = 0;
- if (strokes[nIndex * 2 + 1].GetPresence() == XFA_ATTRIBUTEENUM_Visible) {
+ if (strokes[nIndex * 2 + 1].IsVisible()) {
if (nIndex == 0)
fThickness += 2.5f;