summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffline.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-16 15:49:16 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-16 15:49:16 +0000
commit316dd2fcd64d0cda1e1b2cdc39ca541a57766b35 (patch)
treeaf3745a818839a7cebc92927f9e115c429bbbe0b /xfa/fxfa/cxfa_ffline.cpp
parentd021ad2f6306ae9d7b2ab5acf225c3bd8e957f8f (diff)
downloadpdfium-316dd2fcd64d0cda1e1b2cdc39ca541a57766b35.tar.xz
Rename CXFA_Value methods for clarity
This CL marks the methods in CXFA_Value to make it clear which can return nullptr and updates callsites as needed. Change-Id: If1f794bcbbddaa57a1efdd67195df58a77b4373a Reviewed-on: https://pdfium-review.googlesource.com/22773 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffline.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffline.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/xfa/fxfa/cxfa_ffline.cpp b/xfa/fxfa/cxfa_ffline.cpp
index cdaca4a88f..4937a0e7cc 100644
--- a/xfa/fxfa/cxfa_ffline.cpp
+++ b/xfa/fxfa/cxfa_ffline.cpp
@@ -91,20 +91,23 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS,
if (!value)
return;
- CXFA_Line* line = value->GetLine();
FX_ARGB lineColor = 0xFF000000;
float fLineWidth = 1.0f;
XFA_AttributeEnum iStrokeType = XFA_AttributeEnum::Unknown;
XFA_AttributeEnum iCap = XFA_AttributeEnum::Unknown;
- CXFA_Edge* edge = line->GetEdgeIfExists();
- if (edge && !edge->IsVisible())
- return;
- if (edge) {
- lineColor = edge->GetColor();
- iStrokeType = edge->GetStrokeType();
- fLineWidth = edge->GetThickness();
- iCap = edge->GetCapType();
+ CXFA_Line* line = value->GetLineIfExists();
+ if (line) {
+ CXFA_Edge* edge = line->GetEdgeIfExists();
+ if (edge && !edge->IsVisible())
+ return;
+
+ if (edge) {
+ lineColor = edge->GetColor();
+ iStrokeType = edge->GetStrokeType();
+ fLineWidth = edge->GetThickness();
+ iCap = edge->GetCapType();
+ }
}
CFX_Matrix mtRotate = GetRotateMatrix();
@@ -115,12 +118,15 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS,
if (margin)
XFA_RectWithoutMargin(rtLine, margin);
- GetRectFromHand(rtLine, line->GetHand(), fLineWidth);
+ GetRectFromHand(rtLine, line ? line->GetHand() : XFA_AttributeEnum::Left,
+ fLineWidth);
CXFA_GEPath linePath;
- if (line->GetSlope() && rtLine.right() > 0.0f && rtLine.bottom() > 0.0f)
+ if (line && line->GetSlope() && rtLine.right() > 0.0f &&
+ rtLine.bottom() > 0.0f) {
linePath.AddLine(rtLine.TopRight(), rtLine.BottomLeft());
- else
+ } else {
linePath.AddLine(rtLine.TopLeft(), rtLine.BottomRight());
+ }
pGS->SaveGraphState();
pGS->SetLineWidth(fLineWidth);