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

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

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: rebase Created 5 years 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/src/fxge/ge/fx_ge_fontmap.cpp ('k') | core/src/fxge/ge/fx_ge_ps.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/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
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
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
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 }
OLDNEW
« no previous file with comments | « core/src/fxge/ge/fx_ge_fontmap.cpp ('k') | core/src/fxge/ge/fx_ge_ps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698