From 7ffb59f7f540a67fb808c1e5a2a7edfacf125e3a Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 10 Aug 2017 10:16:06 -0400 Subject: Remove CFDE_Path This CL removes CFDE_Path. There is only one method, AddLine which is required, the rest can be removed. That method is moved to CFX_PathData which is what CFDE_Path is appending to anyway. Change-Id: If50af8cf856a9f7379791fe1999174db5fd13e38 Reviewed-on: https://pdfium-review.googlesource.com/10454 Reviewed-by: Henrique Nakashima Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- core/fxge/cfx_pathdata.cpp | 28 ++++++++++++++++++---------- core/fxge/cfx_pathdata.h | 1 + 2 files changed, 19 insertions(+), 10 deletions(-) (limited to 'core/fxge') diff --git a/core/fxge/cfx_pathdata.cpp b/core/fxge/cfx_pathdata.cpp index fe3c6778d5..1dbb44638c 100644 --- a/core/fxge/cfx_pathdata.cpp +++ b/core/fxge/cfx_pathdata.cpp @@ -202,20 +202,28 @@ void CFX_PathData::AppendPoint(const CFX_PointF& point, m_Points.push_back(FX_PATHPOINT(point, type, closeFigure)); } +void CFX_PathData::AppendLine(const CFX_PointF& pt1, const CFX_PointF& pt2) { + if (m_Points.empty() || fabs(m_Points.back().m_Point.x - pt1.x) > 0.001 || + fabs(m_Points.back().m_Point.y - pt1.y) > 0.001) { + AppendPoint(pt1, FXPT_TYPE::MoveTo, false); + } + AppendPoint(pt2, FXPT_TYPE::LineTo, false); +} + void CFX_PathData::AppendRect(float left, float bottom, float right, float top) { - m_Points.push_back( - FX_PATHPOINT(CFX_PointF(left, bottom), FXPT_TYPE::MoveTo, false)); - m_Points.push_back( - FX_PATHPOINT(CFX_PointF(left, top), FXPT_TYPE::LineTo, false)); - m_Points.push_back( - FX_PATHPOINT(CFX_PointF(right, top), FXPT_TYPE::LineTo, false)); - m_Points.push_back( - FX_PATHPOINT(CFX_PointF(right, bottom), FXPT_TYPE::LineTo, false)); - m_Points.push_back( - FX_PATHPOINT(CFX_PointF(left, bottom), FXPT_TYPE::LineTo, true)); + CFX_PointF left_bottom(left, bottom); + CFX_PointF left_top(left, top); + CFX_PointF right_top(right, top); + CFX_PointF right_bottom(right, bottom); + + AppendLine(left_bottom, left_top); + AppendLine(left_top, right_top); + AppendLine(right_top, right_bottom); + AppendLine(right_bottom, left_bottom); + ClosePath(); } CFX_FloatRect CFX_PathData::GetBoundingBox() const { diff --git a/core/fxge/cfx_pathdata.h b/core/fxge/cfx_pathdata.h index bcb2b7aadf..0e2bb89f9f 100644 --- a/core/fxge/cfx_pathdata.h +++ b/core/fxge/cfx_pathdata.h @@ -60,6 +60,7 @@ class CFX_PathData { void Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix); void AppendRect(float left, float bottom, float right, float top); + void AppendLine(const CFX_PointF& pt1, const CFX_PointF& pt2); void AppendPoint(const CFX_PointF& pos, FXPT_TYPE type, bool closeFigure); void ClosePath(); -- cgit v1.2.3