Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Side by Side Diff: core/fxge/ge/fx_ge_path.cpp

Issue 2032613003: Get rid of NULLs in core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Fix a bad merge Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fxge/ge/fx_ge_linux.cpp ('k') | core/fxge/ge/fx_ge_text.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/fxcrt/include/fx_system.h" 7 #include "core/fxcrt/include/fx_system.h"
8 #include "core/fxge/include/fx_ge.h" 8 #include "core/fxge/include/fx_ge.h"
9 #include "third_party/base/numerics/safe_math.h" 9 #include "third_party/base/numerics/safe_math.h"
10 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 } 108 }
109 m_Box = new_box; 109 m_Box = new_box;
110 m_Mask = new_mask; 110 m_Mask = new_mask;
111 return; 111 return;
112 } 112 }
113 ASSERT(FALSE); 113 ASSERT(FALSE);
114 } 114 }
115 CFX_PathData::CFX_PathData() { 115 CFX_PathData::CFX_PathData() {
116 m_PointCount = m_AllocCount = 0; 116 m_PointCount = m_AllocCount = 0;
117 m_pPoints = NULL; 117 m_pPoints = nullptr;
118 } 118 }
119 CFX_PathData::~CFX_PathData() { 119 CFX_PathData::~CFX_PathData() {
120 FX_Free(m_pPoints); 120 FX_Free(m_pPoints);
121 } 121 }
122 void CFX_PathData::SetPointCount(int nPoints) { 122 void CFX_PathData::SetPointCount(int nPoints) {
123 m_PointCount = nPoints; 123 m_PointCount = nPoints;
124 if (m_AllocCount < nPoints) { 124 if (m_AllocCount < nPoints) {
125 FX_Free(m_pPoints); 125 FX_Free(m_pPoints);
126 m_pPoints = FX_Alloc(FX_PATHPOINT, nPoints); 126 m_pPoints = FX_Alloc(FX_PATHPOINT, nPoints);
127 m_AllocCount = nPoints; 127 m_AllocCount = nPoints;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 break; 453 break;
454 } 454 }
455 int new_count = t_path.GetPointCount(); 455 int new_count = t_path.GetPointCount();
456 t_path.AddPointCount(2); 456 t_path.AddPointCount(2);
457 t_path.SetPoint(new_count, m_pPoints[mid - i].m_PointX, 457 t_path.SetPoint(new_count, m_pPoints[mid - i].m_PointX,
458 m_pPoints[mid - i].m_PointY, FXPT_MOVETO); 458 m_pPoints[mid - i].m_PointY, FXPT_MOVETO);
459 t_path.SetPoint(new_count + 1, m_pPoints[mid - i - 1].m_PointX, 459 t_path.SetPoint(new_count + 1, m_pPoints[mid - i - 1].m_PointX,
460 m_pPoints[mid - i - 1].m_PointY, FXPT_LINETO); 460 m_pPoints[mid - i - 1].m_PointY, FXPT_LINETO);
461 } 461 }
462 if (!bZeroArea) { 462 if (!bZeroArea) {
463 NewPath.Append(&t_path, NULL); 463 NewPath.Append(&t_path, nullptr);
464 bThin = TRUE; 464 bThin = TRUE;
465 return TRUE; 465 return TRUE;
466 } 466 }
467 } 467 }
468 int stratPoint = 0; 468 int stratPoint = 0;
469 int next = 0, i; 469 int next = 0, i;
470 for (i = 0; i < m_PointCount; i++) { 470 for (i = 0; i < m_PointCount; i++) {
471 int point_type = m_pPoints[i].m_Flag & FXPT_TYPE; 471 int point_type = m_pPoints[i].m_Flag & FXPT_TYPE;
472 if (point_type == FXPT_MOVETO) { 472 if (point_type == FXPT_MOVETO) {
473 stratPoint = i; 473 stratPoint = i;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 } 613 }
614 return TRUE; 614 return TRUE;
615 } 615 }
616 void CFX_PathData::Copy(const CFX_PathData& src) { 616 void CFX_PathData::Copy(const CFX_PathData& src) {
617 SetPointCount(src.m_PointCount); 617 SetPointCount(src.m_PointCount);
618 FXSYS_memcpy(m_pPoints, src.m_pPoints, sizeof(FX_PATHPOINT) * m_PointCount); 618 FXSYS_memcpy(m_pPoints, src.m_pPoints, sizeof(FX_PATHPOINT) * m_PointCount);
619 } 619 }
620 CFX_GraphStateData::CFX_GraphStateData() { 620 CFX_GraphStateData::CFX_GraphStateData() {
621 m_LineCap = LineCapButt; 621 m_LineCap = LineCapButt;
622 m_DashCount = 0; 622 m_DashCount = 0;
623 m_DashArray = NULL; 623 m_DashArray = nullptr;
624 m_DashPhase = 0; 624 m_DashPhase = 0;
625 m_LineJoin = LineJoinMiter; 625 m_LineJoin = LineJoinMiter;
626 m_MiterLimit = 10 * 1.0f; 626 m_MiterLimit = 10 * 1.0f;
627 m_LineWidth = 1.0f; 627 m_LineWidth = 1.0f;
628 } 628 }
629 CFX_GraphStateData::CFX_GraphStateData(const CFX_GraphStateData& src) { 629 CFX_GraphStateData::CFX_GraphStateData(const CFX_GraphStateData& src) {
630 m_DashArray = NULL; 630 m_DashArray = nullptr;
631 Copy(src); 631 Copy(src);
632 } 632 }
633 void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) { 633 void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) {
634 m_LineCap = src.m_LineCap; 634 m_LineCap = src.m_LineCap;
635 m_DashCount = src.m_DashCount; 635 m_DashCount = src.m_DashCount;
636 FX_Free(m_DashArray); 636 FX_Free(m_DashArray);
637 m_DashArray = NULL; 637 m_DashArray = nullptr;
638 m_DashPhase = src.m_DashPhase; 638 m_DashPhase = src.m_DashPhase;
639 m_LineJoin = src.m_LineJoin; 639 m_LineJoin = src.m_LineJoin;
640 m_MiterLimit = src.m_MiterLimit; 640 m_MiterLimit = src.m_MiterLimit;
641 m_LineWidth = src.m_LineWidth; 641 m_LineWidth = src.m_LineWidth;
642 if (m_DashCount) { 642 if (m_DashCount) {
643 m_DashArray = FX_Alloc(FX_FLOAT, m_DashCount); 643 m_DashArray = FX_Alloc(FX_FLOAT, m_DashCount);
644 FXSYS_memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(FX_FLOAT)); 644 FXSYS_memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(FX_FLOAT));
645 } 645 }
646 } 646 }
647 CFX_GraphStateData::~CFX_GraphStateData() { 647 CFX_GraphStateData::~CFX_GraphStateData() {
648 FX_Free(m_DashArray); 648 FX_Free(m_DashArray);
649 } 649 }
650 void CFX_GraphStateData::SetDashCount(int count) { 650 void CFX_GraphStateData::SetDashCount(int count) {
651 FX_Free(m_DashArray); 651 FX_Free(m_DashArray);
652 m_DashArray = NULL; 652 m_DashArray = nullptr;
653 m_DashCount = count; 653 m_DashCount = count;
654 if (count == 0) { 654 if (count == 0) {
655 return; 655 return;
656 } 656 }
657 m_DashArray = FX_Alloc(FX_FLOAT, count); 657 m_DashArray = FX_Alloc(FX_FLOAT, count);
658 } 658 }
OLDNEW
« no previous file with comments | « core/fxge/ge/fx_ge_linux.cpp ('k') | core/fxge/ge/fx_ge_text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698