From 1699413c207c228ae7eae3d47e89adacc1146d65 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 20 Nov 2017 21:16:43 +0000 Subject: Cleanup return types in CXFA_BoxData This CL cleans up the return types in CXFA_BoxData to use std::tuple and pdfium::Optional where appropriate. Change-Id: I0790fb43769185fa4cbdd7460411a3d1120e9fa1 Reviewed-on: https://pdfium-review.googlesource.com/18812 Commit-Queue: dsinclair Reviewed-by: Ryan Harrison --- xfa/fxfa/cxfa_ffwidget.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'xfa/fxfa/cxfa_ffwidget.cpp') diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 6bcf524586..bb2d2e8a1c 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -54,16 +54,16 @@ void XFA_BOX_GetPath_Arc(const CXFA_BoxData& boxData, rtDraw.top = center.y - b; rtDraw.width = a + a; rtDraw.height = b + b; - float startAngle = 0, sweepAngle = 360; - bool bStart = boxData.GetStartAngle(startAngle); - bool bEnd = boxData.GetSweepAngle(sweepAngle); - if (!bStart && !bEnd) { + pdfium::Optional startAngle = boxData.GetStartAngle(); + pdfium::Optional sweepAngle = boxData.GetSweepAngle(); + if (!startAngle && !sweepAngle) { fillPath.AddEllipse(rtDraw); return; } - startAngle = -startAngle * FX_PI / 180.0f; - sweepAngle = -sweepAngle * FX_PI / 180.0f; - fillPath.AddArc(rtDraw.TopLeft(), rtDraw.Size(), startAngle, sweepAngle); + + fillPath.AddArc(rtDraw.TopLeft(), rtDraw.Size(), + -startAngle.value_or(0) * FX_PI / 180.0f, + -sweepAngle.value_or(360) * FX_PI / 180.0f); } void XFA_BOX_GetPath(const std::vector& strokes, @@ -560,7 +560,8 @@ void XFA_BOX_StrokeArc(const CXFA_BoxData& boxData, bool bVisible = false; float fThickness = 0; - int32_t i3DType = boxData.Get3DStyle(bVisible, fThickness); + int32_t i3DType = 0; + std::tie(i3DType, bVisible, fThickness) = boxData.Get3DStyle(); if (i3DType) { if (bVisible && fThickness >= 0.001f) { dwFlags |= XFA_DRAWBOX_Lowered3D; @@ -727,7 +728,8 @@ void XFA_BOX_Stroke_Rect(CXFA_BoxData boxData, const CFX_Matrix& matrix) { bool bVisible = false; float fThickness = 0; - int32_t i3DType = boxData.Get3DStyle(bVisible, fThickness); + int32_t i3DType = 0; + std::tie(i3DType, bVisible, fThickness) = boxData.Get3DStyle(); if (i3DType) { if (!bVisible || fThickness < 0.001f) { return; -- cgit v1.2.3