diff options
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r-- | core/fpdfapi/page/cpdf_clippath.cpp | 5 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_contentparser.cpp | 6 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_path.cpp | 13 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_path.h | 5 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_streamcontentparser.cpp | 9 |
5 files changed, 16 insertions, 22 deletions
diff --git a/core/fpdfapi/page/cpdf_clippath.cpp b/core/fpdfapi/page/cpdf_clippath.cpp index cfcd9a1e64..714b56bff3 100644 --- a/core/fpdfapi/page/cpdf_clippath.cpp +++ b/core/fpdfapi/page/cpdf_clippath.cpp @@ -84,8 +84,9 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, uint8_t type, bool bAutoMerge) { if (!pData->m_PathAndTypeList.empty() && bAutoMerge) { const CPDF_Path& old_path = pData->m_PathAndTypeList.back().first; if (old_path.IsRect()) { - CFX_FloatRect old_rect(old_path.GetPointX(0), old_path.GetPointY(0), - old_path.GetPointX(2), old_path.GetPointY(2)); + CFX_PointF point0 = old_path.GetPoint(0); + CFX_PointF point2 = old_path.GetPoint(2); + CFX_FloatRect old_rect(point0.x, point0.y, point2.x, point2.y); CFX_FloatRect new_rect = path.GetBoundingBox(); if (old_rect.Contains(new_rect)) pData->m_PathAndTypeList.pop_back(); diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp index 7f00eabb86..7ceb509348 100644 --- a/core/fpdfapi/page/cpdf_contentparser.cpp +++ b/core/fpdfapi/page/cpdf_contentparser.cpp @@ -203,8 +203,10 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) { CPDF_Path ClipPath = pObj->m_ClipPath.GetPath(0); if (!ClipPath.IsRect() || pObj->IsShading()) continue; - CFX_FloatRect old_rect(ClipPath.GetPointX(0), ClipPath.GetPointY(0), - ClipPath.GetPointX(2), ClipPath.GetPointY(2)); + + CFX_PointF point0 = ClipPath.GetPoint(0); + CFX_PointF point2 = ClipPath.GetPoint(2); + CFX_FloatRect old_rect(point0.x, point0.y, point2.x, point2.y); CFX_FloatRect obj_rect(pObj->m_Left, pObj->m_Bottom, pObj->m_Right, pObj->m_Top); if (old_rect.Contains(obj_rect)) diff --git a/core/fpdfapi/page/cpdf_path.cpp b/core/fpdfapi/page/cpdf_path.cpp index a95ce1e5bc..ddc6bbd1d6 100644 --- a/core/fpdfapi/page/cpdf_path.cpp +++ b/core/fpdfapi/page/cpdf_path.cpp @@ -20,12 +20,8 @@ void CPDF_Path::ClosePath() { m_Ref.GetPrivateCopy()->ClosePath(); } -FX_FLOAT CPDF_Path::GetPointX(int index) const { - return m_Ref.GetObject()->GetPointX(index); -} - -FX_FLOAT CPDF_Path::GetPointY(int index) const { - return m_Ref.GetObject()->GetPointY(index); +CFX_PointF CPDF_Path::GetPoint(int index) const { + return m_Ref.GetObject()->GetPoint(index); } CFX_FloatRect CPDF_Path::GetBoundingBox() const { @@ -60,11 +56,10 @@ void CPDF_Path::AppendRect(FX_FLOAT left, m_Ref.GetPrivateCopy()->AppendRect(left, bottom, right, top); } -void CPDF_Path::AppendPoint(FX_FLOAT x, - FX_FLOAT y, +void CPDF_Path::AppendPoint(const CFX_PointF& point, FXPT_TYPE type, bool close) { CFX_PathData data; - data.AppendPoint(x, y, type, close); + data.AppendPoint(point, type, close); Append(&data, nullptr); } diff --git a/core/fpdfapi/page/cpdf_path.h b/core/fpdfapi/page/cpdf_path.h index 97dd8fd8a9..b0c5a68a44 100644 --- a/core/fpdfapi/page/cpdf_path.h +++ b/core/fpdfapi/page/cpdf_path.h @@ -27,8 +27,7 @@ class CPDF_Path { const std::vector<FX_PATHPOINT>& GetPoints() const; void ClosePath(); - FX_FLOAT GetPointX(int index) const; - FX_FLOAT GetPointY(int index) const; + CFX_PointF GetPoint(int index) const; CFX_FloatRect GetBoundingBox() const; CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const; @@ -38,7 +37,7 @@ class CPDF_Path { void Append(const CPDF_Path& other, const CFX_Matrix* pMatrix); void Append(const CFX_PathData* pData, const CFX_Matrix* pMatrix); void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top); - void AppendPoint(FX_FLOAT x, FX_FLOAT y, FXPT_TYPE type, bool close); + void AppendPoint(const CFX_PointF& point, FXPT_TYPE type, bool close); // TODO(tsepez): Remove when all access thru this class. const CFX_PathData* GetObject() const { return m_Ref.GetObject(); } diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index b8c9c4c6af..d8e1c1e15d 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -1445,8 +1445,7 @@ void CPDF_StreamContentParser::AddPathPoint(FX_FLOAT x, m_PathStartY = y; if (m_PathPointCount && m_pPathPoints[m_PathPointCount - 1].IsTypeAndOpen(FXPT_TYPE::MoveTo)) { - m_pPathPoints[m_PathPointCount - 1].m_PointX = x; - m_pPathPoints[m_PathPointCount - 1].m_PointY = y; + m_pPathPoints[m_PathPointCount - 1].m_Point = CFX_PointF(x, y); return; } } else if (m_PathPointCount == 0) { @@ -1466,8 +1465,7 @@ void CPDF_StreamContentParser::AddPathPoint(FX_FLOAT x, } m_pPathPoints[m_PathPointCount - 1].m_Type = type; m_pPathPoints[m_PathPointCount - 1].m_CloseFigure = close; - m_pPathPoints[m_PathPointCount - 1].m_PointX = x; - m_pPathPoints[m_PathPointCount - 1].m_PointY = y; + m_pPathPoints[m_PathPointCount - 1].m_Point = CFX_PointF(x, y); } void CPDF_StreamContentParser::AddPathObject(int FillType, bool bStroke) { @@ -1491,8 +1489,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, bool bStroke) { CPDF_Path Path; for (int i = 0; i < PathPointCount; i++) { FX_PATHPOINT& point = m_pPathPoints[i]; - Path.AppendPoint(point.m_PointX, point.m_PointY, point.m_Type, - point.m_CloseFigure); + Path.AppendPoint(point.m_Point, point.m_Type, point.m_CloseFigure); } CFX_Matrix matrix = m_pCurStates->m_CTM; |