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 "../../../include/fpdfapi/fpdf_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "pageint.h" | 9 #include "pageint.h" |
10 CPDF_PageObject* CPDF_PageObject::Create(int type) | 10 CPDF_PageObject* CPDF_PageObject::Create(int type) |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 return; | 634 return; |
635 } | 635 } |
636 CFX_FloatRect rect = m_ClipPath.GetClipBox(); | 636 CFX_FloatRect rect = m_ClipPath.GetClipBox(); |
637 m_Left = rect.left; | 637 m_Left = rect.left; |
638 m_Bottom = rect.bottom; | 638 m_Bottom = rect.bottom; |
639 m_Right = rect.right; | 639 m_Right = rect.right; |
640 m_Top = rect.top; | 640 m_Top = rect.top; |
641 } | 641 } |
642 CPDF_FormObject::~CPDF_FormObject() | 642 CPDF_FormObject::~CPDF_FormObject() |
643 { | 643 { |
644 if (m_pForm) { | 644 delete m_pForm; |
645 delete m_pForm; | |
646 } | |
647 } | 645 } |
648 void CPDF_FormObject::Transform(const CFX_AffineMatrix& matrix) | 646 void CPDF_FormObject::Transform(const CFX_AffineMatrix& matrix) |
649 { | 647 { |
650 m_FormMatrix.Concat(matrix); | 648 m_FormMatrix.Concat(matrix); |
651 CalcBoundingBox(); | 649 CalcBoundingBox(); |
652 } | 650 } |
653 void CPDF_FormObject::CopyData(const CPDF_PageObject* pSrc) | 651 void CPDF_FormObject::CopyData(const CPDF_PageObject* pSrc) |
654 { | 652 { |
655 const CPDF_FormObject* pSrcObj = (const CPDF_FormObject*)pSrc; | 653 const CPDF_FormObject* pSrcObj = (const CPDF_FormObject*)pSrc; |
656 if (m_pForm) { | 654 delete m_pForm; |
657 delete m_pForm; | |
658 } | |
659 m_pForm = pSrcObj->m_pForm->Clone(); | 655 m_pForm = pSrcObj->m_pForm->Clone(); |
660 m_FormMatrix = pSrcObj->m_FormMatrix; | 656 m_FormMatrix = pSrcObj->m_FormMatrix; |
661 } | 657 } |
662 void CPDF_FormObject::CalcBoundingBox() | 658 void CPDF_FormObject::CalcBoundingBox() |
663 { | 659 { |
664 CFX_FloatRect form_rect = m_pForm->CalcBoundingBox(); | 660 CFX_FloatRect form_rect = m_pForm->CalcBoundingBox(); |
665 form_rect.Transform(&m_FormMatrix); | 661 form_rect.Transform(&m_FormMatrix); |
666 m_Left = form_rect.left; | 662 m_Left = form_rect.left; |
667 m_Bottom = form_rect.bottom; | 663 m_Bottom = form_rect.bottom; |
668 m_Right = form_rect.right; | 664 m_Right = form_rect.right; |
669 m_Top = form_rect.top; | 665 m_Top = form_rect.top; |
670 } | 666 } |
671 CPDF_PageObjects::CPDF_PageObjects(FX_BOOL bReleaseMembers) : m_ObjectList(128) | 667 CPDF_PageObjects::CPDF_PageObjects(FX_BOOL bReleaseMembers) : m_ObjectList(128) |
672 { | 668 { |
673 m_bBackgroundAlphaNeeded = FALSE; | 669 m_bBackgroundAlphaNeeded = FALSE; |
674 m_bReleaseMembers = bReleaseMembers; | 670 m_bReleaseMembers = bReleaseMembers; |
675 m_ParseState = PDF_CONTENT_NOT_PARSED; | 671 m_ParseState = PDF_CONTENT_NOT_PARSED; |
676 m_pParser = NULL; | 672 m_pParser = NULL; |
677 m_pFormStream = NULL; | 673 m_pFormStream = NULL; |
678 m_pResources = NULL; | 674 m_pResources = NULL; |
679 } | 675 } |
680 CPDF_PageObjects::~CPDF_PageObjects() | 676 CPDF_PageObjects::~CPDF_PageObjects() |
681 { | 677 { |
682 if (m_pParser) { | 678 delete m_pParser; |
683 delete m_pParser; | |
684 } | |
685 if (!m_bReleaseMembers) { | 679 if (!m_bReleaseMembers) { |
686 return; | 680 return; |
687 } | 681 } |
688 FX_POSITION pos = m_ObjectList.GetHeadPosition(); | 682 FX_POSITION pos = m_ObjectList.GetHeadPosition(); |
689 while (pos) { | 683 while (pos) { |
690 delete (CPDF_PageObject*)m_ObjectList.GetNext(pos); | 684 delete (CPDF_PageObject*)m_ObjectList.GetNext(pos); |
691 } | 685 } |
692 } | 686 } |
693 void CPDF_PageObjects::ContinueParse(IFX_Pause* pPause) | 687 void CPDF_PageObjects::ContinueParse(IFX_Pause* pPause) |
694 { | 688 { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 if (pGroup->GetInteger(FX_BSTRC("I"))) { | 782 if (pGroup->GetInteger(FX_BSTRC("I"))) { |
789 m_Transparency |= PDFTRANS_ISOLATED; | 783 m_Transparency |= PDFTRANS_ISOLATED; |
790 } | 784 } |
791 if (pGroup->GetInteger(FX_BSTRC("K"))) { | 785 if (pGroup->GetInteger(FX_BSTRC("K"))) { |
792 m_Transparency |= PDFTRANS_KNOCKOUT; | 786 m_Transparency |= PDFTRANS_KNOCKOUT; |
793 } | 787 } |
794 } | 788 } |
795 void CPDF_PageObjects::ClearCacheObjects() | 789 void CPDF_PageObjects::ClearCacheObjects() |
796 { | 790 { |
797 m_ParseState = PDF_CONTENT_NOT_PARSED; | 791 m_ParseState = PDF_CONTENT_NOT_PARSED; |
798 if (m_pParser) { | 792 delete m_pParser; |
799 delete m_pParser; | |
800 } | |
801 m_pParser = NULL; | 793 m_pParser = NULL; |
802 if (m_bReleaseMembers) { | 794 if (m_bReleaseMembers) { |
803 FX_POSITION pos = m_ObjectList.GetHeadPosition(); | 795 FX_POSITION pos = m_ObjectList.GetHeadPosition(); |
804 while (pos) { | 796 while (pos) { |
805 delete (CPDF_PageObject*)m_ObjectList.GetNext(pos); | 797 delete (CPDF_PageObject*)m_ObjectList.GetNext(pos); |
806 } | 798 } |
807 } | 799 } |
808 m_ObjectList.RemoveAll(); | 800 m_ObjectList.RemoveAll(); |
809 } | 801 } |
810 CPDF_Page::CPDF_Page() | 802 CPDF_Page::CPDF_Page() |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 matrix = m_PageMatrix; | 1013 matrix = m_PageMatrix; |
1022 matrix.Concat(display_matrix); | 1014 matrix.Concat(display_matrix); |
1023 } | 1015 } |
1024 CPDF_ParseOptions::CPDF_ParseOptions() | 1016 CPDF_ParseOptions::CPDF_ParseOptions() |
1025 { | 1017 { |
1026 m_bTextOnly = FALSE; | 1018 m_bTextOnly = FALSE; |
1027 m_bMarkedContent = TRUE; | 1019 m_bMarkedContent = TRUE; |
1028 m_bSeparateForm = TRUE; | 1020 m_bSeparateForm = TRUE; |
1029 m_bDecodeInlineImage = FALSE; | 1021 m_bDecodeInlineImage = FALSE; |
1030 } | 1022 } |
OLD | NEW |