From 316dd2fcd64d0cda1e1b2cdc39ca541a57766b35 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 16 Jan 2018 15:49:16 +0000 Subject: 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 Reviewed-by: Ryan Harrison --- xfa/fxfa/cxfa_ffline.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'xfa/fxfa/cxfa_ffline.cpp') 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); -- cgit v1.2.3