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

Side by Side Diff: fpdfsdk/src/fsdk_baseannot.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 | « fpdfsdk/src/fpdfview.cpp ('k') | fpdfsdk/src/fxedit/fxet_edit.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_ext.h" 7 #include "core/include/fxcrt/fx_ext.h"
8 #include "fpdfsdk/include/fsdk_baseannot.h" 8 #include "fpdfsdk/include/fsdk_baseannot.h"
9 #include "fpdfsdk/include/fsdk_define.h" 9 #include "fpdfsdk/include/fsdk_define.h"
10 #include "fpdfsdk/include/fsdk_mgr.h" 10 #include "fpdfsdk/include/fsdk_mgr.h"
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, 559 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device,
560 mode, pOptions); 560 mode, pOptions);
561 } 561 }
562 562
563 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { 563 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() {
564 return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL; 564 return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL;
565 } 565 }
566 566
567 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { 567 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) {
568 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); 568 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP");
569 if (pAP == NULL) 569 if (!pAP)
570 return FALSE; 570 return FALSE;
571 571
572 // Choose the right sub-ap 572 // Choose the right sub-ap
573 const FX_CHAR* ap_entry = "N"; 573 const FX_CHAR* ap_entry = "N";
574 if (mode == CPDF_Annot::Down) 574 if (mode == CPDF_Annot::Down)
575 ap_entry = "D"; 575 ap_entry = "D";
576 else if (mode == CPDF_Annot::Rollover) 576 else if (mode == CPDF_Annot::Rollover)
577 ap_entry = "R"; 577 ap_entry = "R";
578 if (!pAP->KeyExist(ap_entry)) 578 if (!pAP->KeyExist(ap_entry))
579 ap_entry = "N"; 579 ap_entry = "N";
580 580
581 // Get the AP stream or subdirectory 581 // Get the AP stream or subdirectory
582 CPDF_Object* psub = pAP->GetElementValue(ap_entry); 582 CPDF_Object* psub = pAP->GetElementValue(ap_entry);
583 if (psub == NULL) 583 return !!psub;
584 return FALSE;
585
586 return TRUE;
587 } 584 }
588 585
589 void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice, 586 void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice,
590 const CFX_Matrix* pUser2Device, 587 const CFX_Matrix* pUser2Device,
591 const CPDF_RenderOptions* pOptions) { 588 const CPDF_RenderOptions* pOptions) {
592 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); 589 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions);
593 } 590 }
594 591
595 void CPDFSDK_BAAnnot::ClearCachedAP() { 592 void CPDFSDK_BAAnnot::ClearCachedAP() {
596 m_pAnnot->ClearCachedAP(); 593 m_pAnnot->ClearCachedAP();
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 961
965 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { 962 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() {
966 return GetPDFPage(); 963 return GetPDFPage();
967 } 964 }
968 965
969 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { 966 CPDF_Page* CPDFSDK_Annot::GetPDFPage() {
970 if (m_pPageView) 967 if (m_pPageView)
971 return m_pPageView->GetPDFPage(); 968 return m_pPageView->GetPDFPage();
972 return NULL; 969 return NULL;
973 } 970 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdfview.cpp ('k') | fpdfsdk/src/fxedit/fxet_edit.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698