| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fxgraphics/cfx_path_generator.h" | 7 #include "xfa/fxgraphics/cfx_path_generator.h" |
| 8 | 8 |
| 9 CFX_PathGenerator::CFX_PathGenerator() { | 9 CFX_PathGenerator::CFX_PathGenerator() : m_pPathData(nullptr) {} |
| 10 m_pPathData = NULL; | 10 |
| 11 } | |
| 12 void CFX_PathGenerator::Create() { | 11 void CFX_PathGenerator::Create() { |
| 13 m_pPathData = new CFX_PathData; | 12 m_pPathData = new CFX_PathData; |
| 14 } | 13 } |
| 14 |
| 15 CFX_PathGenerator::~CFX_PathGenerator() { | 15 CFX_PathGenerator::~CFX_PathGenerator() { |
| 16 if (m_pPathData) { | 16 delete m_pPathData; |
| 17 delete m_pPathData; | |
| 18 m_pPathData = NULL; | |
| 19 } | |
| 20 } | 17 } |
| 18 |
| 21 void CFX_PathGenerator::AddPathData(CFX_PathData* pPathData) { | 19 void CFX_PathGenerator::AddPathData(CFX_PathData* pPathData) { |
| 22 if (pPathData && pPathData->GetPointCount() > 0) { | 20 if (pPathData && pPathData->GetPointCount() > 0) { |
| 23 int nCount = pPathData->GetPointCount(); | 21 int nCount = pPathData->GetPointCount(); |
| 24 FX_PATHPOINT* pPoints = pPathData->GetPoints(); | 22 FX_PATHPOINT* pPoints = pPathData->GetPoints(); |
| 25 AddPathData(pPoints, nCount); | 23 AddPathData(pPoints, nCount); |
| 26 } | 24 } |
| 27 } | 25 } |
| 28 void CFX_PathGenerator::AddPathData(FX_PATHPOINT* pPoints, int nCount) { | 26 void CFX_PathGenerator::AddPathData(FX_PATHPOINT* pPoints, int nCount) { |
| 29 if (pPoints && nCount > 0) { | 27 if (pPoints && nCount > 0) { |
| 30 int nOldCount = m_pPathData->GetPointCount(); | 28 int nOldCount = m_pPathData->GetPointCount(); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 m_pPathData->SetPoint(old_count, x, y, FXPT_MOVETO); | 188 m_pPathData->SetPoint(old_count, x, y, FXPT_MOVETO); |
| 191 m_pPathData->SetPoint(old_count + 1, x + (width * FXSYS_cos(start_angle)), | 189 m_pPathData->SetPoint(old_count + 1, x + (width * FXSYS_cos(start_angle)), |
| 192 y + (height * FXSYS_sin(start_angle)), FXPT_LINETO); | 190 y + (height * FXSYS_sin(start_angle)), FXPT_LINETO); |
| 193 return; | 191 return; |
| 194 } | 192 } |
| 195 AddArc(x, y, width, height, start_angle, sweep_angle); | 193 AddArc(x, y, width, height, start_angle, sweep_angle); |
| 196 m_pPathData->AddPointCount(1); | 194 m_pPathData->AddPointCount(1); |
| 197 m_pPathData->SetPoint(m_pPathData->GetPointCount() - 1, x, y, | 195 m_pPathData->SetPoint(m_pPathData->GetPointCount() - 1, x, y, |
| 198 FXPT_LINETO | FXPT_CLOSEFIGURE); | 196 FXPT_LINETO | FXPT_CLOSEFIGURE); |
| 199 } | 197 } |
| OLD | NEW |