From b147e07ee36be10ca0796a6566be107077c21a03 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Wed, 22 Feb 2017 19:56:15 -0500 Subject: Convert point x,y into CFX_PointF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl converts the PointX,PointY pairs into a CFX_PointF. Change-Id: I46897832077c317a5bffb4e568550705decbc40c Reviewed-on: https://pdfium-review.googlesource.com/2821 Commit-Queue: dsinclair Reviewed-by: Tom Sepez Reviewed-by: Nicolás Peña --- core/fxge/ge/cfx_font.cpp | 56 ++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 30 deletions(-) (limited to 'core/fxge/ge/cfx_font.cpp') diff --git a/core/fxge/ge/cfx_font.cpp b/core/fxge/ge/cfx_font.cpp index ef6960a3d7..87157b0101 100644 --- a/core/fxge/ge/cfx_font.cpp +++ b/core/fxge/ge/cfx_font.cpp @@ -88,18 +88,14 @@ void Outline_CheckEmptyContour(OUTLINE_PARAMS* param) { size_t size = points.size(); if (size >= 2 && points[size - 2].IsTypeAndOpen(FXPT_TYPE::MoveTo) && - points[size - 2].m_PointX == points[size - 1].m_PointX && - points[size - 2].m_PointY == points[size - 1].m_PointY) { + points[size - 2].m_Point == points[size - 1].m_Point) { size -= 2; } if (size >= 4 && points[size - 4].IsTypeAndOpen(FXPT_TYPE::MoveTo) && points[size - 3].IsTypeAndOpen(FXPT_TYPE::BezierTo) && - points[size - 3].m_PointX == points[size - 4].m_PointX && - points[size - 3].m_PointY == points[size - 4].m_PointY && - points[size - 2].m_PointX == points[size - 4].m_PointX && - points[size - 2].m_PointY == points[size - 4].m_PointY && - points[size - 1].m_PointX == points[size - 4].m_PointX && - points[size - 1].m_PointY == points[size - 4].m_PointY) { + points[size - 3].m_Point == points[size - 4].m_Point && + points[size - 2].m_Point == points[size - 4].m_Point && + points[size - 1].m_Point == points[size - 4].m_Point) { size -= 4; } points.resize(size); @@ -111,9 +107,9 @@ int Outline_MoveTo(const FXFT_Vector* to, void* user) { Outline_CheckEmptyContour(param); param->m_pPath->ClosePath(); - param->m_pPath->AppendPoint(to->x / param->m_CoordUnit, - to->y / param->m_CoordUnit, FXPT_TYPE::MoveTo, - false); + param->m_pPath->AppendPoint( + CFX_PointF(to->x / param->m_CoordUnit, to->y / param->m_CoordUnit), + FXPT_TYPE::MoveTo, false); param->m_CurX = to->x; param->m_CurY = to->y; @@ -123,9 +119,9 @@ int Outline_MoveTo(const FXFT_Vector* to, void* user) { int Outline_LineTo(const FXFT_Vector* to, void* user) { OUTLINE_PARAMS* param = (OUTLINE_PARAMS*)user; - param->m_pPath->AppendPoint(to->x / param->m_CoordUnit, - to->y / param->m_CoordUnit, FXPT_TYPE::LineTo, - false); + param->m_pPath->AppendPoint( + CFX_PointF(to->x / param->m_CoordUnit, to->y / param->m_CoordUnit), + FXPT_TYPE::LineTo, false); param->m_CurX = to->x; param->m_CurY = to->y; @@ -138,20 +134,20 @@ int Outline_ConicTo(const FXFT_Vector* control, OUTLINE_PARAMS* param = (OUTLINE_PARAMS*)user; param->m_pPath->AppendPoint( - (param->m_CurX + (control->x - param->m_CurX) * 2 / 3) / - param->m_CoordUnit, - (param->m_CurY + (control->y - param->m_CurY) * 2 / 3) / - param->m_CoordUnit, + CFX_PointF((param->m_CurX + (control->x - param->m_CurX) * 2 / 3) / + param->m_CoordUnit, + (param->m_CurY + (control->y - param->m_CurY) * 2 / 3) / + param->m_CoordUnit), FXPT_TYPE::BezierTo, false); param->m_pPath->AppendPoint( - (control->x + (to->x - control->x) / 3) / param->m_CoordUnit, - (control->y + (to->y - control->y) / 3) / param->m_CoordUnit, + CFX_PointF((control->x + (to->x - control->x) / 3) / param->m_CoordUnit, + (control->y + (to->y - control->y) / 3) / param->m_CoordUnit), FXPT_TYPE::BezierTo, false); - param->m_pPath->AppendPoint(to->x / param->m_CoordUnit, - to->y / param->m_CoordUnit, FXPT_TYPE::BezierTo, - false); + param->m_pPath->AppendPoint( + CFX_PointF(to->x / param->m_CoordUnit, to->y / param->m_CoordUnit), + FXPT_TYPE::BezierTo, false); param->m_CurX = to->x; param->m_CurY = to->y; @@ -164,17 +160,17 @@ int Outline_CubicTo(const FXFT_Vector* control1, void* user) { OUTLINE_PARAMS* param = (OUTLINE_PARAMS*)user; - param->m_pPath->AppendPoint(control1->x / param->m_CoordUnit, - control1->y / param->m_CoordUnit, + param->m_pPath->AppendPoint(CFX_PointF(control1->x / param->m_CoordUnit, + control1->y / param->m_CoordUnit), FXPT_TYPE::BezierTo, false); - param->m_pPath->AppendPoint(control2->x / param->m_CoordUnit, - control2->y / param->m_CoordUnit, + param->m_pPath->AppendPoint(CFX_PointF(control2->x / param->m_CoordUnit, + control2->y / param->m_CoordUnit), FXPT_TYPE::BezierTo, false); - param->m_pPath->AppendPoint(to->x / param->m_CoordUnit, - to->y / param->m_CoordUnit, FXPT_TYPE::BezierTo, - false); + param->m_pPath->AppendPoint( + CFX_PointF(to->x / param->m_CoordUnit, to->y / param->m_CoordUnit), + FXPT_TYPE::BezierTo, false); param->m_CurX = to->x; param->m_CurY = to->y; -- cgit v1.2.3