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 "core/fpdfapi/fpdf_page/pageint.h" | 7 #include "core/fpdfapi/fpdf_page/pageint.h" |
8 | 8 |
9 #include <limits.h> | 9 #include <limits.h> |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 CPDF_Object* pCSObj, | 127 CPDF_Object* pCSObj, |
128 FX_BOOL bDecode) { | 128 FX_BOOL bDecode) { |
129 if (m_Pos == m_Size) | 129 if (m_Pos == m_Size) |
130 return nullptr; | 130 return nullptr; |
131 | 131 |
132 if (PDFCharIsWhitespace(m_pBuf[m_Pos])) | 132 if (PDFCharIsWhitespace(m_pBuf[m_Pos])) |
133 m_Pos++; | 133 m_Pos++; |
134 | 134 |
135 CFX_ByteString Decoder; | 135 CFX_ByteString Decoder; |
136 CPDF_Dictionary* pParam = nullptr; | 136 CPDF_Dictionary* pParam = nullptr; |
137 CPDF_Object* pFilter = pDict->GetElementValue("Filter"); | 137 CPDF_Object* pFilter = pDict->GetDirectObjectBy("Filter"); |
138 if (pFilter) { | 138 if (pFilter) { |
139 if (CPDF_Array* pArray = pFilter->AsArray()) { | 139 if (CPDF_Array* pArray = pFilter->AsArray()) { |
140 Decoder = pArray->GetStringAt(0); | 140 Decoder = pArray->GetStringAt(0); |
141 CPDF_Array* pParams = pDict->GetArrayBy("DecodeParms"); | 141 CPDF_Array* pParams = pDict->GetArrayBy("DecodeParms"); |
142 if (pParams) | 142 if (pParams) |
143 pParam = pParams->GetDictAt(0); | 143 pParam = pParams->GetDictAt(0); |
144 } else { | 144 } else { |
145 Decoder = pFilter->GetString(); | 145 Decoder = pFilter->GetString(); |
146 pParam = pDict->GetDictBy("DecodeParms"); | 146 pParam = pDict->GetDictBy("DecodeParms"); |
147 } | 147 } |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 } | 705 } |
706 m_pObjectHolder = pPage; | 706 m_pObjectHolder = pPage; |
707 m_bForm = FALSE; | 707 m_bForm = FALSE; |
708 if (pOptions) { | 708 if (pOptions) { |
709 m_Options = *pOptions; | 709 m_Options = *pOptions; |
710 } | 710 } |
711 m_Status = ToBeContinued; | 711 m_Status = ToBeContinued; |
712 m_InternalStage = STAGE_GETCONTENT; | 712 m_InternalStage = STAGE_GETCONTENT; |
713 m_CurrentOffset = 0; | 713 m_CurrentOffset = 0; |
714 | 714 |
715 CPDF_Object* pContent = pPage->m_pFormDict->GetElementValue("Contents"); | 715 CPDF_Object* pContent = pPage->m_pFormDict->GetDirectObjectBy("Contents"); |
716 if (!pContent) { | 716 if (!pContent) { |
717 m_Status = Done; | 717 m_Status = Done; |
718 return; | 718 return; |
719 } | 719 } |
720 if (CPDF_Stream* pStream = pContent->AsStream()) { | 720 if (CPDF_Stream* pStream = pContent->AsStream()) { |
721 m_nStreams = 0; | 721 m_nStreams = 0; |
722 m_pSingleStream.reset(new CPDF_StreamAcc); | 722 m_pSingleStream.reset(new CPDF_StreamAcc); |
723 m_pSingleStream->LoadAllData(pStream, FALSE); | 723 m_pSingleStream->LoadAllData(pStream, FALSE); |
724 } else if (CPDF_Array* pArray = pContent->AsArray()) { | 724 } else if (CPDF_Array* pArray = pContent->AsArray()) { |
725 m_nStreams = pArray->GetCount(); | 725 m_nStreams = pArray->GetCount(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 m_pData = (uint8_t*)m_pSingleStream->GetData(); | 819 m_pData = (uint8_t*)m_pSingleStream->GetData(); |
820 m_Size = m_pSingleStream->GetSize(); | 820 m_Size = m_pSingleStream->GetSize(); |
821 } | 821 } |
822 m_InternalStage = STAGE_PARSE; | 822 m_InternalStage = STAGE_PARSE; |
823 m_CurrentOffset = 0; | 823 m_CurrentOffset = 0; |
824 } else { | 824 } else { |
825 CPDF_Array* pContent = | 825 CPDF_Array* pContent = |
826 m_pObjectHolder->m_pFormDict->GetArrayBy("Contents"); | 826 m_pObjectHolder->m_pFormDict->GetArrayBy("Contents"); |
827 m_StreamArray[m_CurrentOffset].reset(new CPDF_StreamAcc); | 827 m_StreamArray[m_CurrentOffset].reset(new CPDF_StreamAcc); |
828 CPDF_Stream* pStreamObj = ToStream( | 828 CPDF_Stream* pStreamObj = ToStream( |
829 pContent ? pContent->GetElementValue(m_CurrentOffset) : nullptr); | 829 pContent ? pContent->GetDirectObjectAt(m_CurrentOffset) : nullptr); |
830 m_StreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE); | 830 m_StreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE); |
831 m_CurrentOffset++; | 831 m_CurrentOffset++; |
832 } | 832 } |
833 } | 833 } |
834 if (m_InternalStage == STAGE_PARSE) { | 834 if (m_InternalStage == STAGE_PARSE) { |
835 if (!m_pParser) { | 835 if (!m_pParser) { |
836 m_pParser.reset(new CPDF_StreamContentParser( | 836 m_pParser.reset(new CPDF_StreamContentParser( |
837 m_pObjectHolder->m_pDocument, m_pObjectHolder->m_pPageResources, | 837 m_pObjectHolder->m_pDocument, m_pObjectHolder->m_pPageResources, |
838 nullptr, nullptr, m_pObjectHolder, m_pObjectHolder->m_pResources, | 838 nullptr, nullptr, m_pObjectHolder, m_pObjectHolder->m_pResources, |
839 &m_pObjectHolder->m_BBox, &m_Options, nullptr, 0)); | 839 &m_pObjectHolder->m_BBox, &m_Options, nullptr, 0)); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 } | 885 } |
886 m_Status = Done; | 886 m_Status = Done; |
887 return; | 887 return; |
888 } | 888 } |
889 steps++; | 889 steps++; |
890 if (pPause && pPause->NeedToPauseNow()) { | 890 if (pPause && pPause->NeedToPauseNow()) { |
891 break; | 891 break; |
892 } | 892 } |
893 } | 893 } |
894 } | 894 } |
OLD | NEW |