OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "fpdfsdk/include/cpdfsdk_pageview.h" | 7 #include "fpdfsdk/include/cpdfsdk_pageview.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
10 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" | 10 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) | 517 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) |
518 m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr()->ReleaseAnnot(pAnnot); | 518 m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr()->ReleaseAnnot(pAnnot); |
519 m_fxAnnotArray.clear(); | 519 m_fxAnnotArray.clear(); |
520 m_pAnnotList.reset(); | 520 m_pAnnotList.reset(); |
521 SetLock(FALSE); | 521 SetLock(FALSE); |
522 } | 522 } |
523 | 523 |
524 void CPDFSDK_PageView::UpdateRects(const std::vector<CFX_FloatRect>& rects) { | 524 void CPDFSDK_PageView::UpdateRects(const std::vector<CFX_FloatRect>& rects) { |
525 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); | 525 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
526 for (const auto& rc : rects) | 526 for (const auto& rc : rects) |
527 pEnv->FFI_Invalidate(m_page, rc.left, rc.top, rc.right, rc.bottom); | 527 pEnv->Invalidate(m_page, rc.left, rc.top, rc.right, rc.bottom); |
528 } | 528 } |
529 | 529 |
530 void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) { | 530 void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) { |
531 CFX_FloatRect rcWindow = pAnnot->GetRect(); | 531 CFX_FloatRect rcWindow = pAnnot->GetRect(); |
532 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); | 532 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
533 pEnv->FFI_Invalidate(m_page, rcWindow.left, rcWindow.top, rcWindow.right, | 533 pEnv->Invalidate(m_page, rcWindow.left, rcWindow.top, rcWindow.right, |
534 rcWindow.bottom); | 534 rcWindow.bottom); |
535 } | 535 } |
536 | 536 |
537 int CPDFSDK_PageView::GetPageIndex() const { | 537 int CPDFSDK_PageView::GetPageIndex() const { |
538 if (!m_page) | 538 if (!m_page) |
539 return -1; | 539 return -1; |
540 | 540 |
541 #ifdef PDF_ENABLE_XFA | 541 #ifdef PDF_ENABLE_XFA |
542 int nDocType = m_page->GetDocument()->GetDocType(); | 542 int nDocType = m_page->GetDocument()->GetDocType(); |
543 switch (nDocType) { | 543 switch (nDocType) { |
544 case DOCTYPE_DYNAMIC_XFA: { | 544 case DOCTYPE_DYNAMIC_XFA: { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 return pAnnot; | 578 return pAnnot; |
579 } | 579 } |
580 return nullptr; | 580 return nullptr; |
581 } | 581 } |
582 | 582 |
583 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { | 583 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { |
584 CPDF_Dictionary* pDict = GetPDFPage()->m_pFormDict; | 584 CPDF_Dictionary* pDict = GetPDFPage()->m_pFormDict; |
585 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); | 585 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); |
586 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; | 586 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; |
587 } | 587 } |
OLD | NEW |