summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffwidget.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-20 21:16:43 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-20 21:16:43 +0000
commit1699413c207c228ae7eae3d47e89adacc1146d65 (patch)
tree2a6020ff5b1d658c618ea32a04f86aaa9ee86b72 /xfa/fxfa/cxfa_ffwidget.cpp
parentef2b74990f4f2a82e279ef5b8a911d89be1e83e2 (diff)
downloadpdfium-1699413c207c228ae7eae3d47e89adacc1146d65.tar.xz
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 <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffwidget.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp20
1 files changed, 11 insertions, 9 deletions
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<float> startAngle = boxData.GetStartAngle();
+ pdfium::Optional<float> 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<CXFA_StrokeData>& 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;