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 "core/include/fxcrt/fx_system.h" | 7 #include "core/include/fxcrt/fx_system.h" |
8 #include "core/include/fxge/fx_ge.h" | 8 #include "core/include/fxge/fx_ge.h" |
9 #include "third_party/base/numerics/safe_math.h" | 9 #include "third_party/base/numerics/safe_math.h" |
10 | 10 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 _UpdateLineJoinPoints(rect, start_x, start_y, middle_x, middle_y, end_x, | 377 _UpdateLineJoinPoints(rect, start_x, start_y, middle_x, middle_y, end_x, |
378 end_y, half_width, miter_limit); | 378 end_y, half_width, miter_limit); |
379 } else { | 379 } else { |
380 _UpdateLineEndPoints(rect, start_x, start_y, end_x, end_y, half_width); | 380 _UpdateLineEndPoints(rect, start_x, start_y, end_x, end_y, half_width); |
381 } | 381 } |
382 iPoint++; | 382 iPoint++; |
383 } | 383 } |
384 return rect; | 384 return rect; |
385 } | 385 } |
386 void CFX_PathData::Transform(const CFX_Matrix* pMatrix) { | 386 void CFX_PathData::Transform(const CFX_Matrix* pMatrix) { |
387 if (pMatrix == NULL) { | 387 if (!pMatrix) { |
388 return; | 388 return; |
389 } | 389 } |
390 for (int i = 0; i < m_PointCount; i++) { | 390 for (int i = 0; i < m_PointCount; i++) { |
391 pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY); | 391 pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY); |
392 } | 392 } |
393 } | 393 } |
394 FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, | 394 FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, |
395 CFX_Matrix* pMatrix, | 395 CFX_Matrix* pMatrix, |
396 FX_BOOL& bThin, | 396 FX_BOOL& bThin, |
397 FX_BOOL bAdjust) const { | 397 FX_BOOL bAdjust) const { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 } | 557 } |
558 if (m_pPoints[i].m_PointX != m_pPoints[i - 1].m_PointX && | 558 if (m_pPoints[i].m_PointX != m_pPoints[i - 1].m_PointX && |
559 m_pPoints[i].m_PointY != m_pPoints[i - 1].m_PointY) { | 559 m_pPoints[i].m_PointY != m_pPoints[i - 1].m_PointY) { |
560 return FALSE; | 560 return FALSE; |
561 } | 561 } |
562 } | 562 } |
563 return m_PointCount == 5 || (m_pPoints[3].m_Flag & FXPT_CLOSEFIGURE); | 563 return m_PointCount == 5 || (m_pPoints[3].m_Flag & FXPT_CLOSEFIGURE); |
564 } | 564 } |
565 FX_BOOL CFX_PathData::IsRect(const CFX_Matrix* pMatrix, | 565 FX_BOOL CFX_PathData::IsRect(const CFX_Matrix* pMatrix, |
566 CFX_FloatRect* pRect) const { | 566 CFX_FloatRect* pRect) const { |
567 if (pMatrix == NULL) { | 567 if (!pMatrix) { |
568 if (!IsRect()) { | 568 if (!IsRect()) { |
569 return FALSE; | 569 return FALSE; |
570 } | 570 } |
571 if (pRect) { | 571 if (pRect) { |
572 pRect->left = m_pPoints[0].m_PointX; | 572 pRect->left = m_pPoints[0].m_PointX; |
573 pRect->right = m_pPoints[2].m_PointX; | 573 pRect->right = m_pPoints[2].m_PointX; |
574 pRect->bottom = m_pPoints[0].m_PointY; | 574 pRect->bottom = m_pPoints[0].m_PointY; |
575 pRect->top = m_pPoints[2].m_PointY; | 575 pRect->top = m_pPoints[2].m_PointY; |
576 pRect->Normalize(); | 576 pRect->Normalize(); |
577 } | 577 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 } | 648 } |
649 void CFX_GraphStateData::SetDashCount(int count) { | 649 void CFX_GraphStateData::SetDashCount(int count) { |
650 FX_Free(m_DashArray); | 650 FX_Free(m_DashArray); |
651 m_DashArray = NULL; | 651 m_DashArray = NULL; |
652 m_DashCount = count; | 652 m_DashCount = count; |
653 if (count == 0) { | 653 if (count == 0) { |
654 return; | 654 return; |
655 } | 655 } |
656 m_DashArray = FX_Alloc(FX_FLOAT, count); | 656 m_DashArray = FX_Alloc(FX_FLOAT, count); |
657 } | 657 } |
OLD | NEW |