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 "pageint.h" | 7 #include "pageint.h" |
8 | 8 |
9 #include "core/include/fpdfapi/fpdf_module.h" | 9 #include "core/include/fpdfapi/fpdf_module.h" |
10 #include "core/include/fpdfapi/fpdf_page.h" | 10 #include "core/include/fpdfapi/fpdf_page.h" |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 m_FormMatrix = pSrcObj->m_FormMatrix; | 659 m_FormMatrix = pSrcObj->m_FormMatrix; |
660 } | 660 } |
661 void CPDF_FormObject::CalcBoundingBox() { | 661 void CPDF_FormObject::CalcBoundingBox() { |
662 CFX_FloatRect form_rect = m_pForm->CalcBoundingBox(); | 662 CFX_FloatRect form_rect = m_pForm->CalcBoundingBox(); |
663 form_rect.Transform(&m_FormMatrix); | 663 form_rect.Transform(&m_FormMatrix); |
664 m_Left = form_rect.left; | 664 m_Left = form_rect.left; |
665 m_Bottom = form_rect.bottom; | 665 m_Bottom = form_rect.bottom; |
666 m_Right = form_rect.right; | 666 m_Right = form_rect.right; |
667 m_Top = form_rect.top; | 667 m_Top = form_rect.top; |
668 } | 668 } |
669 CPDF_PageObjects::CPDF_PageObjects() | 669 CPDF_PageObjectList::CPDF_PageObjectList() |
670 : m_pFormDict(nullptr), | 670 : m_pFormDict(nullptr), |
671 m_pFormStream(nullptr), | 671 m_pFormStream(nullptr), |
672 m_pDocument(nullptr), | 672 m_pDocument(nullptr), |
673 m_pPageResources(nullptr), | 673 m_pPageResources(nullptr), |
674 m_pResources(nullptr), | 674 m_pResources(nullptr), |
675 m_Transparency(0), | 675 m_Transparency(0), |
676 m_bBackgroundAlphaNeeded(FALSE), | 676 m_bBackgroundAlphaNeeded(FALSE), |
677 m_bHasImageMask(FALSE), | 677 m_bHasImageMask(FALSE), |
678 m_ParseState(CONTENT_NOT_PARSED), | 678 m_ParseState(CONTENT_NOT_PARSED), |
679 m_ObjectList(128) {} | 679 m_ObjectList(128) {} |
680 CPDF_PageObjects::~CPDF_PageObjects() { | 680 CPDF_PageObjectList::~CPDF_PageObjectList() { |
681 FX_POSITION pos = m_ObjectList.GetHeadPosition(); | 681 FX_POSITION pos = m_ObjectList.GetHeadPosition(); |
682 while (pos) { | 682 while (pos) { |
683 delete (CPDF_PageObject*)m_ObjectList.GetNext(pos); | 683 delete (CPDF_PageObject*)m_ObjectList.GetNext(pos); |
684 } | 684 } |
685 } | 685 } |
686 void CPDF_PageObjects::ContinueParse(IFX_Pause* pPause) { | 686 void CPDF_PageObjectList::ContinueParse(IFX_Pause* pPause) { |
687 if (!m_pParser) { | 687 if (!m_pParser) { |
688 return; | 688 return; |
689 } | 689 } |
690 m_pParser->Continue(pPause); | 690 m_pParser->Continue(pPause); |
691 if (m_pParser->GetStatus() == CPDF_ContentParser::Done) { | 691 if (m_pParser->GetStatus() == CPDF_ContentParser::Done) { |
692 m_ParseState = CONTENT_PARSED; | 692 m_ParseState = CONTENT_PARSED; |
693 m_pParser.reset(); | 693 m_pParser.reset(); |
694 } | 694 } |
695 } | 695 } |
696 FX_POSITION CPDF_PageObjects::InsertObject(FX_POSITION posInsertAfter, | 696 FX_POSITION CPDF_PageObjectList::InsertObject(FX_POSITION posInsertAfter, |
697 CPDF_PageObject* pNewObject) { | 697 CPDF_PageObject* pNewObject) { |
698 if (!posInsertAfter) { | 698 if (!posInsertAfter) { |
699 return m_ObjectList.AddHead(pNewObject); | 699 return m_ObjectList.AddHead(pNewObject); |
700 } | 700 } |
701 return m_ObjectList.InsertAfter(posInsertAfter, pNewObject); | 701 return m_ObjectList.InsertAfter(posInsertAfter, pNewObject); |
702 } | 702 } |
703 int CPDF_PageObjects::GetObjectIndex(CPDF_PageObject* pObj) const { | 703 int CPDF_PageObjectList::GetObjectIndex(CPDF_PageObject* pObj) const { |
704 int index = 0; | 704 int index = 0; |
705 FX_POSITION pos = m_ObjectList.GetHeadPosition(); | 705 FX_POSITION pos = m_ObjectList.GetHeadPosition(); |
706 while (pos) { | 706 while (pos) { |
707 CPDF_PageObject* pThisObj = (CPDF_PageObject*)m_ObjectList.GetNext(pos); | 707 CPDF_PageObject* pThisObj = (CPDF_PageObject*)m_ObjectList.GetNext(pos); |
708 if (pThisObj == pObj) { | 708 if (pThisObj == pObj) { |
709 return index; | 709 return index; |
710 } | 710 } |
711 index++; | 711 index++; |
712 } | 712 } |
713 return -1; | 713 return -1; |
714 } | 714 } |
715 CPDF_PageObject* CPDF_PageObjects::GetObjectByIndex(int index) const { | 715 CPDF_PageObject* CPDF_PageObjectList::GetObjectByIndex(int index) const { |
716 FX_POSITION pos = m_ObjectList.FindIndex(index); | 716 FX_POSITION pos = m_ObjectList.FindIndex(index); |
717 return pos ? static_cast<CPDF_PageObject*>(m_ObjectList.GetAt(pos)) : nullptr; | 717 return pos ? static_cast<CPDF_PageObject*>(m_ObjectList.GetAt(pos)) : nullptr; |
718 } | 718 } |
719 void CPDF_PageObjects::Transform(const CFX_Matrix& matrix) { | 719 void CPDF_PageObjectList::Transform(const CFX_Matrix& matrix) { |
720 FX_POSITION pos = m_ObjectList.GetHeadPosition(); | 720 FX_POSITION pos = m_ObjectList.GetHeadPosition(); |
721 while (pos) { | 721 while (pos) { |
722 CPDF_PageObject* pObj = (CPDF_PageObject*)m_ObjectList.GetNext(pos); | 722 CPDF_PageObject* pObj = (CPDF_PageObject*)m_ObjectList.GetNext(pos); |
723 pObj->Transform(matrix); | 723 pObj->Transform(matrix); |
724 } | 724 } |
725 } | 725 } |
726 CFX_FloatRect CPDF_PageObjects::CalcBoundingBox() const { | 726 CFX_FloatRect CPDF_PageObjectList::CalcBoundingBox() const { |
727 if (m_ObjectList.GetCount() == 0) { | 727 if (m_ObjectList.GetCount() == 0) { |
728 return CFX_FloatRect(0, 0, 0, 0); | 728 return CFX_FloatRect(0, 0, 0, 0); |
729 } | 729 } |
730 FX_FLOAT left, right, top, bottom; | 730 FX_FLOAT left, right, top, bottom; |
731 left = bottom = 1000000 * 1.0f; | 731 left = bottom = 1000000 * 1.0f; |
732 right = top = -1000000 * 1.0f; | 732 right = top = -1000000 * 1.0f; |
733 FX_POSITION pos = m_ObjectList.GetHeadPosition(); | 733 FX_POSITION pos = m_ObjectList.GetHeadPosition(); |
734 while (pos) { | 734 while (pos) { |
735 CPDF_PageObject* pObj = (CPDF_PageObject*)m_ObjectList.GetNext(pos); | 735 CPDF_PageObject* pObj = (CPDF_PageObject*)m_ObjectList.GetNext(pos); |
736 if (left > pObj->m_Left) { | 736 if (left > pObj->m_Left) { |
737 left = pObj->m_Left; | 737 left = pObj->m_Left; |
738 } | 738 } |
739 if (right < pObj->m_Right) { | 739 if (right < pObj->m_Right) { |
740 right = pObj->m_Right; | 740 right = pObj->m_Right; |
741 } | 741 } |
742 if (top < pObj->m_Top) { | 742 if (top < pObj->m_Top) { |
743 top = pObj->m_Top; | 743 top = pObj->m_Top; |
744 } | 744 } |
745 if (bottom > pObj->m_Bottom) { | 745 if (bottom > pObj->m_Bottom) { |
746 bottom = pObj->m_Bottom; | 746 bottom = pObj->m_Bottom; |
747 } | 747 } |
748 } | 748 } |
749 return CFX_FloatRect(left, bottom, right, top); | 749 return CFX_FloatRect(left, bottom, right, top); |
750 } | 750 } |
751 void CPDF_PageObjects::LoadTransInfo() { | 751 void CPDF_PageObjectList::LoadTransInfo() { |
752 if (!m_pFormDict) { | 752 if (!m_pFormDict) { |
753 return; | 753 return; |
754 } | 754 } |
755 CPDF_Dictionary* pGroup = m_pFormDict->GetDict("Group"); | 755 CPDF_Dictionary* pGroup = m_pFormDict->GetDict("Group"); |
756 if (!pGroup) { | 756 if (!pGroup) { |
757 return; | 757 return; |
758 } | 758 } |
759 if (pGroup->GetString("S") != "Transparency") { | 759 if (pGroup->GetString("S") != "Transparency") { |
760 return; | 760 return; |
761 } | 761 } |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 (FX_FLOAT)y0); | 982 (FX_FLOAT)y0); |
983 matrix = m_PageMatrix; | 983 matrix = m_PageMatrix; |
984 matrix.Concat(display_matrix); | 984 matrix.Concat(display_matrix); |
985 } | 985 } |
986 CPDF_ParseOptions::CPDF_ParseOptions() { | 986 CPDF_ParseOptions::CPDF_ParseOptions() { |
987 m_bTextOnly = FALSE; | 987 m_bTextOnly = FALSE; |
988 m_bMarkedContent = TRUE; | 988 m_bMarkedContent = TRUE; |
989 m_bSeparateForm = TRUE; | 989 m_bSeparateForm = TRUE; |
990 m_bDecodeInlineImage = FALSE; | 990 m_bDecodeInlineImage = FALSE; |
991 } | 991 } |
OLD | NEW |