summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fxcrt/fx_coordinates.h5
-rw-r--r--xfa/fde/cfde_path.cpp52
-rw-r--r--xfa/fde/cfde_path.h16
-rw-r--r--xfa/fde/fde_gedevice.cpp20
-rw-r--r--xfa/fde/fde_gedevice.h12
5 files changed, 52 insertions, 53 deletions
diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h
index d8ad4efe48..979603864b 100644
--- a/core/fxcrt/fx_coordinates.h
+++ b/core/fxcrt/fx_coordinates.h
@@ -75,11 +75,6 @@ typedef CFX_PSTemplate<FX_FLOAT> CFX_PointF;
typedef CFX_PSTemplate<int32_t> CFX_Size;
typedef CFX_PSTemplate<FX_FLOAT> CFX_SizeF;
-#ifdef PDF_ENABLE_XFA
-typedef CFX_ArrayTemplate<CFX_Point> CFX_Points;
-typedef CFX_ArrayTemplate<CFX_PointF> CFX_PointsF;
-#endif // PDF_ENABLE_XFA
-
template <class BaseType>
class CFX_VTemplate : public CFX_PSTemplate<BaseType> {
public:
diff --git a/xfa/fde/cfde_path.cpp b/xfa/fde/cfde_path.cpp
index 23aad50549..6db0ccc6bf 100644
--- a/xfa/fde/cfde_path.cpp
+++ b/xfa/fde/cfde_path.cpp
@@ -6,6 +6,7 @@
#include "xfa/fde/cfde_path.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fde/fde_object.h"
bool CFDE_Path::StartFigure() {
@@ -106,39 +107,38 @@ void CFDE_Path::ArcTo(bool bStart,
CFX_PointF(cx + rx * cos_beta, cy + ry * sin_beta));
}
-void CFDE_Path::AddBezier(const CFX_PointsF& points) {
- if (points.GetSize() != 4)
+void CFDE_Path::AddBezier(const std::vector<CFX_PointF>& points) {
+ if (points.size() != 4)
return;
- const CFX_PointF* p = points.GetData();
- MoveTo(p[0]);
- BezierTo(p[1], p[2], p[3]);
+ MoveTo(points[0]);
+ BezierTo(points[1], points[2], points[3]);
}
-void CFDE_Path::AddBeziers(const CFX_PointsF& points) {
- int32_t iCount = points.GetSize();
+void CFDE_Path::AddBeziers(const std::vector<CFX_PointF>& points) {
+ int32_t iCount = points.size();
if (iCount < 4)
return;
- const CFX_PointF* p = points.GetData();
+ const CFX_PointF* p = points.data();
const CFX_PointF* pEnd = p + iCount;
MoveTo(p[0]);
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,
+void CFDE_Path::GetCurveTangents(const std::vector<CFX_PointF>& points,
+ std::vector<CFX_PointF>* tangents,
bool bClosed,
FX_FLOAT fTension) const {
- int32_t iCount = points.GetSize();
- tangents.SetSize(iCount);
+ int32_t iCount = pdfium::CollectionSize<int32_t>(points);
+ tangents->resize(iCount);
if (iCount < 3)
return;
FX_FLOAT fCoefficient = fTension / 3.0f;
- const CFX_PointF* pPoints = points.GetData();
- CFX_PointF* pTangents = tangents.GetData();
+ const CFX_PointF* pPoints = points.data();
+ CFX_PointF* pTangents = tangents->data();
for (int32_t i = 0; i < iCount; ++i) {
int32_t r = i + 1;
int32_t s = i - 1;
@@ -152,17 +152,17 @@ void CFDE_Path::GetCurveTangents(const CFX_PointsF& points,
}
}
-void CFDE_Path::AddCurve(const CFX_PointsF& points,
+void CFDE_Path::AddCurve(const std::vector<CFX_PointF>& points,
bool bClosed,
FX_FLOAT fTension) {
- int32_t iLast = points.GetUpperBound();
+ int32_t iLast = pdfium::CollectionSize<int32_t>(points) - 1;
if (iLast < 1)
return;
- CFX_PointsF tangents;
- GetCurveTangents(points, tangents, bClosed, fTension);
- const CFX_PointF* pPoints = points.GetData();
- CFX_PointF* pTangents = tangents.GetData();
+ std::vector<CFX_PointF> tangents;
+ GetCurveTangents(points, &tangents, bClosed, fTension);
+ const CFX_PointF* pPoints = points.data();
+ CFX_PointF* pTangents = tangents.data();
MoveTo(pPoints[0]);
for (int32_t i = 0; i < iLast; ++i) {
BezierTo(CFX_PointF(pPoints[i].x + pTangents[i].x,
@@ -214,13 +214,13 @@ void CFDE_Path::AddPath(const CFDE_Path* pSrc, bool bConnect) {
m_Path.Append(&pSrc->m_Path, nullptr);
}
-void CFDE_Path::AddPolygon(const CFX_PointsF& points) {
- int32_t iCount = points.GetSize();
+void CFDE_Path::AddPolygon(const std::vector<CFX_PointF>& points) {
+ size_t iCount = points.size();
if (iCount < 2)
return;
AddLines(points);
- const CFX_PointF* p = points.GetData();
+ const CFX_PointF* p = points.data();
if (FXSYS_fabs(p[0].x - p[iCount - 1].x) < 0.01f ||
FXSYS_fabs(p[0].y - p[iCount - 1].y) < 0.01f) {
LineTo(p[0]);
@@ -228,12 +228,12 @@ void CFDE_Path::AddPolygon(const CFX_PointsF& points) {
CloseFigure();
}
-void CFDE_Path::AddLines(const CFX_PointsF& points) {
- int32_t iCount = points.GetSize();
+void CFDE_Path::AddLines(const std::vector<CFX_PointF>& points) {
+ size_t iCount = points.size();
if (iCount < 2)
return;
- const CFX_PointF* p = points.GetData();
+ const CFX_PointF* p = points.data();
const CFX_PointF* pEnd = p + iCount;
MoveTo(p[0]);
for (++p; p < pEnd; ++p)
diff --git a/xfa/fde/cfde_path.h b/xfa/fde/cfde_path.h
index 936a5c8a78..d2d8fe99ec 100644
--- a/xfa/fde/cfde_path.h
+++ b/xfa/fde/cfde_path.h
@@ -7,6 +7,8 @@
#ifndef XFA_FDE_CFDE_PATH_H_
#define XFA_FDE_CFDE_PATH_H_
+#include <vector>
+
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
@@ -15,16 +17,16 @@ class CFDE_Path {
bool StartFigure();
bool CloseFigure();
- void AddBezier(const CFX_PointsF& points);
- void AddBeziers(const CFX_PointsF& points);
- void AddCurve(const CFX_PointsF& points,
+ void AddBezier(const std::vector<CFX_PointF>& points);
+ void AddBeziers(const std::vector<CFX_PointF>& points);
+ void AddCurve(const std::vector<CFX_PointF>& points,
bool bClosed,
FX_FLOAT fTension = 0.5f);
void AddEllipse(const CFX_RectF& rect);
- void AddLines(const CFX_PointsF& points);
+ void AddLines(const std::vector<CFX_PointF>& points);
void AddLine(const CFX_PointF& pt1, const CFX_PointF& pt2);
void AddPath(const CFDE_Path* pSrc, bool bConnect);
- void AddPolygon(const CFX_PointsF& points);
+ void AddPolygon(const std::vector<CFX_PointF>& points);
void AddRectangle(const CFX_RectF& rect);
void GetBBox(CFX_RectF& bbox) const;
void GetBBox(CFX_RectF& bbox,
@@ -44,8 +46,8 @@ class CFDE_Path {
FX_FLOAT endAngle);
void MoveTo(const CFX_PointF& p0) { MoveTo(p0.x, p0.y); }
void LineTo(const CFX_PointF& p1) { LineTo(p1.x, p1.y); }
- void GetCurveTangents(const CFX_PointsF& points,
- CFX_PointsF& tangents,
+ void GetCurveTangents(const std::vector<CFX_PointF>& points,
+ std::vector<CFX_PointF>* tangents,
bool bClosed,
FX_FLOAT fTension) const;
CFX_PathData m_Path;
diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp
index 081f00a036..b5220cdf13 100644
--- a/xfa/fde/fde_gedevice.cpp
+++ b/xfa/fde/fde_gedevice.cpp
@@ -198,18 +198,18 @@ bool CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen,
const CFX_PointF& pt3,
const CFX_PointF& pt4,
const CFX_Matrix* pMatrix) {
- CFX_PointsF points;
- points.Add(pt1);
- points.Add(pt2);
- points.Add(pt3);
- points.Add(pt4);
+ std::vector<CFX_PointF> points;
+ points.push_back(pt1);
+ points.push_back(pt2);
+ points.push_back(pt3);
+ points.push_back(pt4);
CFDE_Path path;
path.AddBezier(points);
return DrawPath(pPen, fPenWidth, &path, pMatrix);
}
bool CFDE_RenderDevice::DrawCurve(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
- const CFX_PointsF& points,
+ const std::vector<CFX_PointF>& points,
bool bClosed,
FX_FLOAT fTension,
const CFX_Matrix* pMatrix) {
@@ -227,7 +227,7 @@ bool CFDE_RenderDevice::DrawEllipse(CFDE_Pen* pPen,
}
bool CFDE_RenderDevice::DrawLines(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
- const CFX_PointsF& points,
+ const std::vector<CFX_PointF>& points,
const CFX_Matrix* pMatrix) {
CFDE_Path path;
path.AddLines(points);
@@ -259,7 +259,7 @@ bool CFDE_RenderDevice::DrawPath(CFDE_Pen* pPen,
}
bool CFDE_RenderDevice::DrawPolygon(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
- const CFX_PointsF& points,
+ const std::vector<CFX_PointF>& points,
const CFX_Matrix* pMatrix) {
CFDE_Path path;
path.AddPolygon(points);
@@ -274,7 +274,7 @@ bool CFDE_RenderDevice::DrawRectangle(CFDE_Pen* pPen,
return DrawPath(pPen, fPenWidth, &path, pMatrix);
}
bool CFDE_RenderDevice::FillClosedCurve(CFDE_Brush* pBrush,
- const CFX_PointsF& points,
+ const std::vector<CFX_PointF>& points,
FX_FLOAT fTension,
const CFX_Matrix* pMatrix) {
CFDE_Path path;
@@ -289,7 +289,7 @@ bool CFDE_RenderDevice::FillEllipse(CFDE_Brush* pBrush,
return FillPath(pBrush, &path, pMatrix);
}
bool CFDE_RenderDevice::FillPolygon(CFDE_Brush* pBrush,
- const CFX_PointsF& points,
+ const std::vector<CFX_PointF>& points,
const CFX_Matrix* pMatrix) {
CFDE_Path path;
path.AddPolygon(points);
diff --git a/xfa/fde/fde_gedevice.h b/xfa/fde/fde_gedevice.h
index 170bef595f..7c772cfd03 100644
--- a/xfa/fde/fde_gedevice.h
+++ b/xfa/fde/fde_gedevice.h
@@ -7,6 +7,8 @@
#ifndef XFA_FDE_FDE_GEDEVICE_H_
#define XFA_FDE_FDE_GEDEVICE_H_
+#include <vector>
+
#include "core/fxge/cfx_renderdevice.h"
#include "xfa/fgas/font/cfgas_gefont.h"
@@ -52,7 +54,7 @@ class CFDE_RenderDevice {
const CFX_Matrix* pMatrix = nullptr);
bool DrawCurve(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
- const CFX_PointsF& points,
+ const std::vector<CFX_PointF>& points,
bool bClosed,
FX_FLOAT fTension = 0.5f,
const CFX_Matrix* pMatrix = nullptr);
@@ -62,7 +64,7 @@ class CFDE_RenderDevice {
const CFX_Matrix* pMatrix = nullptr);
bool DrawLines(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
- const CFX_PointsF& points,
+ const std::vector<CFX_PointF>& points,
const CFX_Matrix* pMatrix = nullptr);
bool DrawLine(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
@@ -75,14 +77,14 @@ class CFDE_RenderDevice {
const CFX_Matrix* pMatrix = nullptr);
bool DrawPolygon(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
- const CFX_PointsF& points,
+ const std::vector<CFX_PointF>& points,
const CFX_Matrix* pMatrix = nullptr);
bool DrawRectangle(CFDE_Pen* pPen,
FX_FLOAT fPenWidth,
const CFX_RectF& rect,
const CFX_Matrix* pMatrix = nullptr);
bool FillClosedCurve(CFDE_Brush* pBrush,
- const CFX_PointsF& points,
+ const std::vector<CFX_PointF>& points,
FX_FLOAT fTension = 0.5f,
const CFX_Matrix* pMatrix = nullptr);
bool FillEllipse(CFDE_Brush* pBrush,
@@ -92,7 +94,7 @@ class CFDE_RenderDevice {
const CFDE_Path* pPath,
const CFX_Matrix* pMatrix = nullptr);
bool FillPolygon(CFDE_Brush* pBrush,
- const CFX_PointsF& points,
+ const std::vector<CFX_PointF>& points,
const CFX_Matrix* pMatrix = nullptr);
bool FillRectangle(CFDE_Brush* pBrush,
const CFX_RectF& rect,