| Index: xfa/fde/cfde_path.cpp | 
| diff --git a/xfa/fde/fde_geobject.cpp b/xfa/fde/cfde_path.cpp | 
| similarity index 89% | 
| rename from xfa/fde/fde_geobject.cpp | 
| rename to xfa/fde/cfde_path.cpp | 
| index f4aede0ee4f3ee9aa26f47ef3b989d3a5988f0f3..7ea458d485307f8b38bd7ae6fcc2b38c5f108bff 100644 | 
| --- a/xfa/fde/fde_geobject.cpp | 
| +++ b/xfa/fde/cfde_path.cpp | 
| @@ -4,57 +4,59 @@ | 
|  | 
| // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 
|  | 
| -#include "xfa/fde/fde_geobject.h" | 
| +#include "xfa/fde/cfde_path.h" | 
|  | 
| #include "xfa/fde/fde_object.h" | 
|  | 
| -IFDE_Path* IFDE_Path::Create() { | 
| -  return new CFDE_Path; | 
| -} | 
| FX_BOOL CFDE_Path::StartFigure() { | 
| return CloseFigure(); | 
| } | 
| + | 
| FX_BOOL CFDE_Path::CloseFigure() { | 
| FX_PATHPOINT* pPoint = GetLastPoint(); | 
| -  if (pPoint) { | 
| +  if (pPoint) | 
| pPoint->m_Flag |= FXPT_CLOSEFIGURE; | 
| -  } | 
| return TRUE; | 
| } | 
| + | 
| FX_PATHPOINT* CFDE_Path::GetLastPoint(int32_t iCount) const { | 
| -  if (iCount < 1) { | 
| -    return NULL; | 
| -  } | 
| +  if (iCount < 1) | 
| +    return nullptr; | 
| + | 
| int32_t iPoints = m_Path.GetPointCount(); | 
| -  if (iCount > iPoints) { | 
| -    return NULL; | 
| -  } | 
| +  if (iCount > iPoints) | 
| +    return nullptr; | 
| return m_Path.GetPoints() + iPoints - iCount; | 
| } | 
| + | 
| FX_BOOL CFDE_Path::FigureClosed() const { | 
| FX_PATHPOINT* pPoint = GetLastPoint(); | 
| return pPoint ? (pPoint->m_Flag & FXPT_CLOSEFIGURE) : TRUE; | 
| } | 
| + | 
| FX_PATHPOINT* CFDE_Path::AddPoints(int32_t iCount) { | 
| -  if (iCount < 1) { | 
| -    return NULL; | 
| -  } | 
| +  if (iCount < 1) | 
| +    return nullptr; | 
| + | 
| int32_t iPoints = m_Path.GetPointCount(); | 
| m_Path.AddPointCount(iCount); | 
| return m_Path.GetPoints() + iPoints; | 
| } | 
| + | 
| void CFDE_Path::MoveTo(FX_FLOAT fx, FX_FLOAT fy) { | 
| FX_PATHPOINT* pPoint = AddPoints(1); | 
| pPoint->m_PointX = fx; | 
| pPoint->m_PointY = fy; | 
| pPoint->m_Flag = FXPT_MOVETO; | 
| } | 
| + | 
| void CFDE_Path::LineTo(FX_FLOAT fx, FX_FLOAT fy) { | 
| FX_PATHPOINT* pPoint = AddPoints(1); | 
| pPoint->m_PointX = fx; | 
| pPoint->m_PointY = fy; | 
| pPoint->m_Flag = FXPT_LINETO; | 
| } | 
| + | 
| void CFDE_Path::BezierTo(const CFX_PointF& p1, | 
| const CFX_PointF& p2, | 
| const CFX_PointF& p3) { | 
| @@ -69,6 +71,7 @@ void CFDE_Path::BezierTo(const CFX_PointF& p1, | 
| p[2].m_PointY = p3.y; | 
| p[2].m_Flag = FXPT_BEZIERTO; | 
| } | 
| + | 
| void CFDE_Path::ArcTo(FX_BOOL bStart, | 
| const CFX_RectF& rect, | 
| FX_FLOAT startAngle, | 
| @@ -82,11 +85,10 @@ void CFDE_Path::ArcTo(FX_BOOL bStart, | 
| FX_FLOAT beta = | 
| FXSYS_atan2(rx * FXSYS_sin(endAngle), ry * FXSYS_cos(endAngle)); | 
| if (FXSYS_fabs(beta - alpha) > FX_PI) { | 
| -    if (beta > alpha) { | 
| +    if (beta > alpha) | 
| beta -= 2 * FX_PI; | 
| -    } else { | 
| +    else | 
| alpha -= 2 * FX_PI; | 
| -    } | 
| } | 
| FX_FLOAT half_delta = (beta - alpha) / 2; | 
| FX_FLOAT bcp = 4.0f / 3 * (1 - FXSYS_cos(half_delta)) / FXSYS_sin(half_delta); | 
| @@ -105,57 +107,58 @@ void CFDE_Path::ArcTo(FX_BOOL bStart, | 
| } | 
|  | 
| void CFDE_Path::AddBezier(const CFX_PointsF& points) { | 
| -  if (points.GetSize() != 4) { | 
| +  if (points.GetSize() != 4) | 
| return; | 
| -  } | 
| + | 
| const CFX_PointF* p = points.GetData(); | 
| MoveTo(p[0]); | 
| BezierTo(p[1], p[2], p[3]); | 
| } | 
| + | 
| void CFDE_Path::AddBeziers(const CFX_PointsF& points) { | 
| int32_t iCount = points.GetSize(); | 
| -  if (iCount < 4) { | 
| +  if (iCount < 4) | 
| return; | 
| -  } | 
| + | 
| const CFX_PointF* p = points.GetData(); | 
| const CFX_PointF* pEnd = p + iCount; | 
| MoveTo(p[0]); | 
| -  for (++p; p <= pEnd - 3; p += 3) { | 
| +  for (++p; p <= pEnd - 3; p += 3) | 
| BezierTo(p[0], p[1], p[2]); | 
| -  } | 
| } | 
| + | 
| void CFDE_Path::GetCurveTangents(const CFX_PointsF& points, | 
| CFX_PointsF& tangents, | 
| FX_BOOL bClosed, | 
| FX_FLOAT fTension) const { | 
| int32_t iCount = points.GetSize(); | 
| tangents.SetSize(iCount); | 
| -  if (iCount < 3) { | 
| +  if (iCount < 3) | 
| return; | 
| -  } | 
| + | 
| FX_FLOAT fCoefficient = fTension / 3.0f; | 
| const CFX_PointF* pPoints = points.GetData(); | 
| CFX_PointF* pTangents = tangents.GetData(); | 
| for (int32_t i = 0; i < iCount; ++i) { | 
| int32_t r = i + 1; | 
| int32_t s = i - 1; | 
| -    if (r >= iCount) { | 
| +    if (r >= iCount) | 
| r = bClosed ? (r - iCount) : (iCount - 1); | 
| -    } | 
| -    if (s < 0) { | 
| +    if (s < 0) | 
| s = bClosed ? (s + iCount) : 0; | 
| -    } | 
| + | 
| pTangents[i].x += (fCoefficient * (pPoints[r].x - pPoints[s].x)); | 
| pTangents[i].y += (fCoefficient * (pPoints[r].y - pPoints[s].y)); | 
| } | 
| } | 
| + | 
| void CFDE_Path::AddCurve(const CFX_PointsF& points, | 
| FX_BOOL bClosed, | 
| FX_FLOAT fTension) { | 
| int32_t iLast = points.GetUpperBound(); | 
| -  if (iLast < 1) { | 
| +  if (iLast < 1) | 
| return; | 
| -  } | 
| + | 
| CFX_PointsF tangents; | 
| GetCurveTangents(points, tangents, bClosed, fTension); | 
| const CFX_PointF* pPoints = points.GetData(); | 
| @@ -177,6 +180,7 @@ void CFDE_Path::AddCurve(const CFX_PointsF& points, | 
| CloseFigure(); | 
| } | 
| } | 
| + | 
| void CFDE_Path::AddEllipse(const CFX_RectF& rect) { | 
| FX_FLOAT fStartAngle = 0; | 
| FX_FLOAT fEndAngle = FX_PI / 2; | 
| @@ -187,33 +191,35 @@ void CFDE_Path::AddEllipse(const CFX_RectF& rect) { | 
| } | 
| CloseFigure(); | 
| } | 
| + | 
| void CFDE_Path::AddLine(const CFX_PointF& pt1, const CFX_PointF& pt2) { | 
| FX_PATHPOINT* pLast = GetLastPoint(); | 
| -  if (pLast == NULL || FXSYS_fabs(pLast->m_PointX - pt1.x) > 0.001 || | 
| +  if (!pLast || FXSYS_fabs(pLast->m_PointX - pt1.x) > 0.001 || | 
| FXSYS_fabs(pLast->m_PointY - pt1.y) > 0.001) { | 
| MoveTo(pt1); | 
| } | 
| LineTo(pt2); | 
| } | 
| -void CFDE_Path::AddPath(const IFDE_Path* pSrc, FX_BOOL bConnect) { | 
| + | 
| +void CFDE_Path::AddPath(const CFDE_Path* pSrc, FX_BOOL bConnect) { | 
| CFDE_Path* pPath = (CFDE_Path*)pSrc; | 
| -  if (pPath == NULL) { | 
| +  if (!pPath) | 
| return; | 
| -  } | 
| + | 
| int32_t iCount = pPath->m_Path.GetPointCount(); | 
| -  if (iCount < 1) { | 
| +  if (iCount < 1) | 
| return; | 
| -  } | 
| -  if (bConnect) { | 
| +  if (bConnect) | 
| LineTo(pPath->m_Path.GetPointX(0), pPath->m_Path.GetPointY(0)); | 
| -  } | 
| -  m_Path.Append(&pPath->m_Path, NULL); | 
| + | 
| +  m_Path.Append(&pPath->m_Path, nullptr); | 
| } | 
| + | 
| void CFDE_Path::AddPolygon(const CFX_PointsF& points) { | 
| int32_t iCount = points.GetSize(); | 
| -  if (iCount < 2) { | 
| +  if (iCount < 2) | 
| return; | 
| -  } | 
| + | 
| AddLines(points); | 
| const CFX_PointF* p = points.GetData(); | 
| if (FXSYS_fabs(p[0].x - p[iCount - 1].x) < 0.01f || | 
| @@ -222,18 +228,19 @@ void CFDE_Path::AddPolygon(const CFX_PointsF& points) { | 
| } | 
| CloseFigure(); | 
| } | 
| + | 
| void CFDE_Path::AddLines(const CFX_PointsF& points) { | 
| int32_t iCount = points.GetSize(); | 
| -  if (iCount < 2) { | 
| +  if (iCount < 2) | 
| return; | 
| -  } | 
| + | 
| const CFX_PointF* p = points.GetData(); | 
| const CFX_PointF* pEnd = p + iCount; | 
| MoveTo(p[0]); | 
| -  for (++p; p < pEnd; ++p) { | 
| +  for (++p; p < pEnd; ++p) | 
| LineTo(*p); | 
| -  } | 
| } | 
| + | 
| void CFDE_Path::AddRectangle(const CFX_RectF& rect) { | 
| MoveTo(rect.TopLeft()); | 
| LineTo(rect.TopRight()); | 
| @@ -241,11 +248,13 @@ void CFDE_Path::AddRectangle(const CFX_RectF& rect) { | 
| LineTo(rect.BottomLeft()); | 
| CloseFigure(); | 
| } | 
| + | 
| void CFDE_Path::GetBBox(CFX_RectF& bbox) const { | 
| CFX_FloatRect rect = m_Path.GetBoundingBox(); | 
| bbox.Set(rect.left, rect.top, rect.Width(), rect.Height()); | 
| bbox.Normalize(); | 
| } | 
| + | 
| void CFDE_Path::GetBBox(CFX_RectF& bbox, | 
| FX_FLOAT fLineWidth, | 
| FX_FLOAT fMiterLimit) const { | 
|  |