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

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: 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
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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 _UpdateLineJoinPoints(rect, start_x, start_y, middle_x, middle_y, end_x, 378 _UpdateLineJoinPoints(rect, start_x, start_y, middle_x, middle_y, end_x,
379 end_y, half_width, miter_limit); 379 end_y, half_width, miter_limit);
380 } else { 380 } else {
381 _UpdateLineEndPoints(rect, start_x, start_y, end_x, end_y, half_width); 381 _UpdateLineEndPoints(rect, start_x, start_y, end_x, end_y, half_width);
382 } 382 }
383 iPoint++; 383 iPoint++;
384 } 384 }
385 return rect; 385 return rect;
386 } 386 }
387 void CFX_PathData::Transform(const CFX_AffineMatrix* pMatrix) { 387 void CFX_PathData::Transform(const CFX_AffineMatrix* pMatrix) {
388 if (pMatrix == NULL) { 388 if (!pMatrix) {
389 return; 389 return;
390 } 390 }
391 for (int i = 0; i < m_PointCount; i++) { 391 for (int i = 0; i < m_PointCount; i++) {
392 pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY); 392 pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY);
393 } 393 }
394 } 394 }
395 FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, 395 FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath,
396 CFX_AffineMatrix* pMatrix, 396 CFX_AffineMatrix* pMatrix,
397 FX_BOOL& bThin, 397 FX_BOOL& bThin,
398 FX_BOOL bAdjust) const { 398 FX_BOOL bAdjust) const {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 } 558 }
559 if (m_pPoints[i].m_PointX != m_pPoints[i - 1].m_PointX && 559 if (m_pPoints[i].m_PointX != m_pPoints[i - 1].m_PointX &&
560 m_pPoints[i].m_PointY != m_pPoints[i - 1].m_PointY) { 560 m_pPoints[i].m_PointY != m_pPoints[i - 1].m_PointY) {
561 return FALSE; 561 return FALSE;
562 } 562 }
563 } 563 }
564 return m_PointCount == 5 || (m_pPoints[3].m_Flag & FXPT_CLOSEFIGURE); 564 return m_PointCount == 5 || (m_pPoints[3].m_Flag & FXPT_CLOSEFIGURE);
565 } 565 }
566 FX_BOOL CFX_PathData::IsRect(const CFX_AffineMatrix* pMatrix, 566 FX_BOOL CFX_PathData::IsRect(const CFX_AffineMatrix* pMatrix,
567 CFX_FloatRect* pRect) const { 567 CFX_FloatRect* pRect) const {
568 if (pMatrix == NULL) { 568 if (!pMatrix) {
569 if (!IsRect()) { 569 if (!IsRect()) {
570 return FALSE; 570 return FALSE;
571 } 571 }
572 if (pRect) { 572 if (pRect) {
573 pRect->left = m_pPoints[0].m_PointX; 573 pRect->left = m_pPoints[0].m_PointX;
574 pRect->right = m_pPoints[2].m_PointX; 574 pRect->right = m_pPoints[2].m_PointX;
575 pRect->bottom = m_pPoints[0].m_PointY; 575 pRect->bottom = m_pPoints[0].m_PointY;
576 pRect->top = m_pPoints[2].m_PointY; 576 pRect->top = m_pPoints[2].m_PointY;
577 pRect->Normalize(); 577 pRect->Normalize();
578 } 578 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = NULL;
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

Powered by Google App Engine
This is Rietveld 408576698