diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-23 13:29:56 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-23 18:52:03 +0000 |
commit | efcf362b6658346ae0f8f3cdb73d871fdd82c8af (patch) | |
tree | 035759c5ba63c89600b5c9e88a2c3120de0e6ff9 /xfa/fxfa/app | |
parent | c6dc69fb69e5d9974aa451d590194d568b78131b (diff) | |
download | pdfium-efcf362b6658346ae0f8f3cdb73d871fdd82c8af.tar.xz |
Merge CFX_PathGenerator into CFX_Path.
The CFX_Path was the only user of the CFX_PathGenerator which in turn just
proxied to the CFX_PathData. This CL removes the CFX_PathGenerator and merges
the code up into CFX_Path.
Change-Id: I9e1a3921c987830f29b2ff5bd4aceacd2082e8f0
Reviewed-on: https://pdfium-review.googlesource.com/2825
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r-- | xfa/fxfa/app/xfa_fffield.cpp | 8 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffpath.cpp | 1 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffpushbutton.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidget.cpp | 22 |
4 files changed, 11 insertions, 25 deletions
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 0c8d8c1b5f..630d04311f 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -82,12 +82,11 @@ void CXFA_FFField::DrawHighlight(CFX_Graphics* pGS, CFX_Color crHighlight(pDoc->GetDocEnvironment()->GetHighlightColor(pDoc)); pGS->SetFillColor(&crHighlight); CFX_Path path; - path.Create(); - if (bEllipse) { + if (bEllipse) path.AddEllipse(m_rtUI); - } else { + else path.AddRectangle(m_rtUI.left, m_rtUI.top, m_rtUI.width, m_rtUI.height); - } + pGS->FillPath(&path, FXFILL_WINDING, pMatrix); } } @@ -100,7 +99,6 @@ void CXFA_FFField::DrawFocus(CFX_Graphics* pGS, CFX_Matrix* pMatrix) { pGS->SetLineWidth(0, false); CFX_Path path; - path.Create(); path.AddRectangle(m_rtUI.left, m_rtUI.top, m_rtUI.width, m_rtUI.height); pGS->StrokePath(&path, pMatrix); } diff --git a/xfa/fxfa/app/xfa_ffpath.cpp b/xfa/fxfa/app/xfa_ffpath.cpp index feea7bf00b..43016fe5c6 100644 --- a/xfa/fxfa/app/xfa_ffpath.cpp +++ b/xfa/fxfa/app/xfa_ffpath.cpp @@ -87,7 +87,6 @@ void CXFA_FFLine::RenderWidget(CFX_Graphics* pGS, GetRectFromHand(rtLine, lineObj.GetHand(), fLineWidth); CFX_Path linePath; - linePath.Create(); if (lineObj.GetSlope() && rtLine.right() > 0.0f && rtLine.bottom() > 0.0f) linePath.AddLine(rtLine.TopRight(), rtLine.BottomLeft()); else diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp index 9c05083bb0..7b6be82035 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.cpp +++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp @@ -214,8 +214,8 @@ void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics, rtFill.Deflate(fLineWith, fLineWith); CFX_Color cr(FXARGB_MAKE(128, 128, 255, 255)); pGraphics->SetFillColor(&cr); + CFX_Path path; - path.Create(); path.AddRectangle(rtFill.left, rtFill.top, rtFill.width, rtFill.height); pGraphics->FillPath(&path, FXFILL_WINDING, (CFX_Matrix*)pMatrix); } @@ -227,9 +227,8 @@ void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics, CFX_Color cr(FXARGB_MAKE(255, 128, 255, 255)); pGraphics->SetStrokeColor(&cr); pGraphics->SetLineWidth(fLineWidth); - CFX_Path path; - path.Create(); + CFX_Path path; CFX_RectF rect = m_pNormalWidget->GetWidgetRect(); path.AddRectangle(0, 0, rect.width, rect.height); pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix); diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 0f47dffa22..e0c70a51e5 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -1635,12 +1635,11 @@ static void XFA_BOX_Fill(CXFA_Box box, CFX_Matrix* pMatrix, uint32_t dwFlags) { CXFA_Fill fill = box.GetFill(); - if (!fill || fill.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { + if (!fill || fill.GetPresence() != XFA_ATTRIBUTEENUM_Visible) return; - } + pGS->SaveGraphState(); CFX_Path fillPath; - fillPath.Create(); XFA_BOX_GetFillPath(box, strokes, rtWidget, fillPath, (dwFlags & XFA_DRAWBOX_ForceRound) != 0); fillPath.Close(); @@ -1729,11 +1728,10 @@ static void XFA_BOX_StrokeArc(CXFA_Box box, } if ((dwFlags & XFA_DRAWBOX_ForceRound) == 0 || (dwFlags & XFA_DRAWBOX_Lowered3D) == 0) { - if (fHalf < 0.001f) { + if (fHalf < 0.001f) return; - } + CFX_Path arcPath; - arcPath.Create(); XFA_BOX_GetPath_Arc(box, rtWidget, arcPath, dwFlags); XFA_BOX_StrokePath(edge, &arcPath, pGS, pMatrix); return; @@ -1760,7 +1758,6 @@ static void XFA_BOX_StrokeArc(CXFA_Box box, sweepAngle = -sweepAngle * FX_PI / 180.0f; CFX_Path arcPath; - arcPath.Create(); arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), 3.0f * FX_PI / 4.0f, FX_PI); @@ -1802,7 +1799,6 @@ static void XFA_Draw3DRect(CFX_Graphics* pGraphic, FX_FLOAT fBottom = rt.bottom(); FX_FLOAT fRight = rt.right(); CFX_Path pathLT; - pathLT.Create(); pathLT.MoveTo(CFX_PointF(rt.left, fBottom)); pathLT.LineTo(CFX_PointF(rt.left, rt.top)); pathLT.LineTo(CFX_PointF(fRight, rt.top)); @@ -1816,7 +1812,6 @@ static void XFA_Draw3DRect(CFX_Graphics* pGraphic, pGraphic->SetFillColor(&crRB); CFX_Path pathRB; - pathRB.Create(); pathRB.MoveTo(CFX_PointF(fRight, rt.top)); pathRB.LineTo(CFX_PointF(fRight, fBottom)); pathRB.LineTo(CFX_PointF(rt.left, fBottom)); @@ -1836,7 +1831,6 @@ static void XFA_BOX_Stroke_3DRect_Lowered(CFX_Graphics* pGS, CFX_Color cr(0xFF000000); pGS->SetFillColor(&cr); CFX_Path path; - path.Create(); path.AddRectangle(rt.left, rt.top, rt.width, rt.height); path.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height); pGS->FillPath(&path, FXFILL_ALTERNATE, pMatrix); @@ -1852,7 +1846,6 @@ static void XFA_BOX_Stroke_3DRect_Raised(CFX_Graphics* pGS, CFX_Color cr(0xFF000000); pGS->SetFillColor(&cr); CFX_Path path; - path.Create(); path.AddRectangle(rt.left, rt.top, rt.width, rt.height); path.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height); pGS->FillPath(&path, FXFILL_ALTERNATE, pMatrix); @@ -1931,17 +1924,14 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box, } if (bSameStyles) { stroke1 = strokes[0]; - if (stroke1.IsInverted()) { + if (stroke1.IsInverted()) bSameStyles = false; - } - if (stroke1.GetJoinType() != XFA_ATTRIBUTEENUM_Square) { + if (stroke1.GetJoinType() != XFA_ATTRIBUTEENUM_Square) bSameStyles = false; - } } } bool bStart = true; CFX_Path path; - path.Create(); for (int32_t i = 0; i < 8; i++) { CXFA_Stroke stroke = strokes[i]; if ((i % 1) == 0 && stroke.GetRadius() < 0) { |