summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-08-10 10:16:06 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-10 21:16:19 +0000
commit7ffb59f7f540a67fb808c1e5a2a7edfacf125e3a (patch)
tree7f6fc5563912ce4b6e8878b4b5fe337eac3d40a8 /core
parentf7520395821090b36a5ad8c658a844c3342dbf66 (diff)
downloadpdfium-7ffb59f7f540a67fb808c1e5a2a7edfacf125e3a.tar.xz
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 <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fxge/cfx_pathdata.cpp28
-rw-r--r--core/fxge/cfx_pathdata.h1
2 files changed, 19 insertions, 10 deletions
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();