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 "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
10 #include "pageint.h" | 10 #include "pageint.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 return; | 84 return; |
85 } | 85 } |
86 } | 86 } |
87 if (type != CPDF_StreamParser::Name) { | 87 if (type != CPDF_StreamParser::Name) { |
88 break; | 88 break; |
89 } | 89 } |
90 CFX_ByteString key((FX_LPCSTR)m_pSyntax->GetWordBuf() + 1, m_pSyntax->Ge tWordSize() - 1); | 90 CFX_ByteString key((FX_LPCSTR)m_pSyntax->GetWordBuf() + 1, m_pSyntax->Ge tWordSize() - 1); |
91 CPDF_Object* pObj = m_pSyntax->ReadNextObject(); | 91 CPDF_Object* pObj = m_pSyntax->ReadNextObject(); |
92 if (!key.IsEmpty()) { | 92 if (!key.IsEmpty()) { |
93 pDict->SetAt(key, pObj, m_pDocument); | 93 pDict->SetAt(key, pObj, m_pDocument); |
94 } else { | 94 } else if (pObj) { |
95 pObj->Release(); | 95 pObj->Release(); |
96 } | 96 } |
97 } | 97 } |
98 _PDF_ReplaceAbbr(pDict); | 98 _PDF_ReplaceAbbr(pDict); |
99 CPDF_Object* pCSObj = NULL; | 99 CPDF_Object* pCSObj = NULL; |
100 if (pDict->KeyExist(FX_BSTRC("ColorSpace"))) { | 100 if (pDict->KeyExist(FX_BSTRC("ColorSpace"))) { |
101 pCSObj = pDict->GetElementValue(FX_BSTRC("ColorSpace")); | 101 pCSObj = pDict->GetElementValue(FX_BSTRC("ColorSpace")); |
102 if (pCSObj->GetType() == PDFOBJ_NAME) { | 102 if (pCSObj->GetType() == PDFOBJ_NAME) { |
103 CFX_ByteString name = pCSObj->GetString(); | 103 CFX_ByteString name = pCSObj->GetString(); |
104 if (name != FX_BSTRC("DeviceRGB") && name != FX_BSTRC("DeviceGray") && name != FX_BSTRC("DeviceCMYK")) { | 104 if (name != FX_BSTRC("DeviceRGB") && name != FX_BSTRC("DeviceGray") && name != FX_BSTRC("DeviceCMYK")) { |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
585 return CPDF_Name::Create(PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1 , m_WordSize - 1))); | 585 return CPDF_Name::Create(PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1 , m_WordSize - 1))); |
586 } | 586 } |
587 if (first_char == '(') { | 587 if (first_char == '(') { |
588 return CPDF_String::Create(ReadString()); | 588 return CPDF_String::Create(ReadString()); |
589 } | 589 } |
590 if (first_char == '<') { | 590 if (first_char == '<') { |
591 if (m_WordSize == 1) { | 591 if (m_WordSize == 1) { |
592 return CPDF_String::Create(ReadHexString(), TRUE); | 592 return CPDF_String::Create(ReadHexString(), TRUE); |
593 } | 593 } |
594 CPDF_Dictionary* pDict = CPDF_Dictionary::Create(); | 594 CPDF_Dictionary* pDict = CPDF_Dictionary::Create(); |
595 while (1) { | 595 while (pDict) { |
Nico
2014/06/28 01:01:07
CPDF_Dictionary::Create() probably never will retu
| |
596 GetNextWord(bIsNumber); | 596 GetNextWord(bIsNumber); |
597 if (m_WordSize == 0) { | 597 if (m_WordSize == 0) { |
598 pDict->Release(); | 598 pDict->Release(); |
599 return NULL; | 599 return NULL; |
600 } | 600 } |
601 if (m_WordSize == 2 && m_WordBuffer[0] == '>') { | 601 if (m_WordSize == 2 && m_WordBuffer[0] == '>') { |
602 break; | 602 break; |
603 } | 603 } |
604 if (m_WordBuffer[0] != '/') { | 604 if (m_WordBuffer[0] != '/') { |
605 pDict->Release(); | 605 pDict->Release(); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1057 m_pStreamArray = NULL; | 1057 m_pStreamArray = NULL; |
1058 } else { | 1058 } else { |
1059 m_pData = (FX_LPBYTE)m_pSingleStream->GetData(); | 1059 m_pData = (FX_LPBYTE)m_pSingleStream->GetData(); |
1060 m_Size = m_pSingleStream->GetSize(); | 1060 m_Size = m_pSingleStream->GetSize(); |
1061 } | 1061 } |
1062 m_InternalStage = PAGEPARSE_STAGE_PARSE; | 1062 m_InternalStage = PAGEPARSE_STAGE_PARSE; |
1063 m_CurrentOffset = 0; | 1063 m_CurrentOffset = 0; |
1064 } else { | 1064 } else { |
1065 CPDF_Array* pContent = m_pObjects->m_pFormDict->GetArray(FX_BSTR C("Contents")); | 1065 CPDF_Array* pContent = m_pObjects->m_pFormDict->GetArray(FX_BSTR C("Contents")); |
1066 m_pStreamArray[m_CurrentOffset] = FX_NEW CPDF_StreamAcc; | 1066 m_pStreamArray[m_CurrentOffset] = FX_NEW CPDF_StreamAcc; |
1067 CPDF_Stream* pStreamObj = (CPDF_Stream*)pContent->GetElementValu e(m_CurrentOffset); | 1067 CPDF_Stream* pStreamObj = (CPDF_Stream*)(pContent ? pContent->Ge tElementValue(m_CurrentOffset) : NULL); |
1068 m_pStreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE); | 1068 m_pStreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE); |
1069 m_CurrentOffset ++; | 1069 m_CurrentOffset ++; |
1070 } | 1070 } |
1071 } | 1071 } |
1072 if (m_InternalStage == PAGEPARSE_STAGE_PARSE) { | 1072 if (m_InternalStage == PAGEPARSE_STAGE_PARSE) { |
1073 if (m_pParser == NULL) { | 1073 if (m_pParser == NULL) { |
1074 m_pParser = FX_NEW CPDF_StreamContentParser; | 1074 m_pParser = FX_NEW CPDF_StreamContentParser; |
1075 m_pParser->Initialize(); | 1075 m_pParser->Initialize(); |
1076 m_pParser->PrepareParse(m_pObjects->m_pDocument, m_pObjects->m_p PageResources, NULL, NULL, m_pObjects, | 1076 m_pParser->PrepareParse(m_pObjects->m_pDocument, m_pObjects->m_p PageResources, NULL, NULL, m_pObjects, |
1077 m_pObjects->m_pResources, &m_pObjects->m _BBox, &m_Options, NULL, 0); | 1077 m_pObjects->m_pResources, &m_pObjects->m _BBox, &m_Options, NULL, 0); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1137 return 100; | 1137 return 100; |
1138 } | 1138 } |
1139 if (m_InternalStage == PAGEPARSE_STAGE_GETCONTENT) { | 1139 if (m_InternalStage == PAGEPARSE_STAGE_GETCONTENT) { |
1140 return 10; | 1140 return 10; |
1141 } | 1141 } |
1142 if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) { | 1142 if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) { |
1143 return 90; | 1143 return 90; |
1144 } | 1144 } |
1145 return 10 + 80 * m_CurrentOffset / m_Size; | 1145 return 10 + 80 * m_CurrentOffset / m_Size; |
1146 } | 1146 } |
OLD | NEW |