| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 | 547 |
| 548 void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, | 548 void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, |
| 549 const CFX_Matrix* pUser2Device, | 549 const CFX_Matrix* pUser2Device, |
| 550 CPDF_Annot::AppearanceMode mode, | 550 CPDF_Annot::AppearanceMode mode, |
| 551 const CPDF_RenderOptions* pOptions) { | 551 const CPDF_RenderOptions* pOptions) { |
| 552 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, | 552 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, |
| 553 mode, pOptions); | 553 mode, pOptions); |
| 554 } | 554 } |
| 555 | 555 |
| 556 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { | 556 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { |
| 557 return m_pAnnot->GetAnnotDict()->GetDictBy("AP") != NULL; | 557 return !!m_pAnnot->GetAnnotDict()->GetDictBy("AP"); |
| 558 } | 558 } |
| 559 | 559 |
| 560 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { | 560 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { |
| 561 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictBy("AP"); | 561 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictBy("AP"); |
| 562 if (!pAP) | 562 if (!pAP) |
| 563 return FALSE; | 563 return FALSE; |
| 564 | 564 |
| 565 // Choose the right sub-ap | 565 // Choose the right sub-ap |
| 566 const FX_CHAR* ap_entry = "N"; | 566 const FX_CHAR* ap_entry = "N"; |
| 567 if (mode == CPDF_Annot::Down) | 567 if (mode == CPDF_Annot::Down) |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 FX_BOOL CPDFSDK_BAAnnot::IsXFAField() { | 907 FX_BOOL CPDFSDK_BAAnnot::IsXFAField() { |
| 908 return FALSE; | 908 return FALSE; |
| 909 } | 909 } |
| 910 #endif // PDF_ENABLE_XFA | 910 #endif // PDF_ENABLE_XFA |
| 911 | 911 |
| 912 void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, | 912 void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, |
| 913 CFX_Matrix* pUser2Device, | 913 CFX_Matrix* pUser2Device, |
| 914 CPDF_RenderOptions* pOptions) { | 914 CPDF_RenderOptions* pOptions) { |
| 915 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); | 915 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); |
| 916 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, | 916 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, |
| 917 CPDF_Annot::Normal, NULL); | 917 CPDF_Annot::Normal, nullptr); |
| 918 } | 918 } |
| 919 | 919 |
| 920 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { | 920 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { |
| 921 #ifdef PDF_ENABLE_XFA | 921 #ifdef PDF_ENABLE_XFA |
| 922 return GetPDFXFAPage(); | 922 return GetPDFXFAPage(); |
| 923 #else // PDF_ENABLE_XFA | 923 #else // PDF_ENABLE_XFA |
| 924 return GetPDFPage(); | 924 return GetPDFPage(); |
| 925 #endif // PDF_ENABLE_XFA | 925 #endif // PDF_ENABLE_XFA |
| 926 } | 926 } |
| 927 | 927 |
| 928 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | 928 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
| 929 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; | 929 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
| 930 } | 930 } |
| 931 | 931 |
| 932 #ifdef PDF_ENABLE_XFA | 932 #ifdef PDF_ENABLE_XFA |
| 933 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { | 933 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
| 934 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; | 934 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; |
| 935 } | 935 } |
| 936 #endif // PDF_ENABLE_XFA | 936 #endif // PDF_ENABLE_XFA |
| OLD | NEW |