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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 m_pSyntax->SetPos(savePos); | 70 m_pSyntax->SetPos(savePos); |
71 pDict->Release(); | 71 pDict->Release(); |
72 return; | 72 return; |
73 } | 73 } |
74 } | 74 } |
75 if (type != CPDF_StreamParser::Name) { | 75 if (type != CPDF_StreamParser::Name) { |
76 break; | 76 break; |
77 } | 77 } |
78 CFX_ByteString key((const FX_CHAR*)m_pSyntax->GetWordBuf() + 1, | 78 CFX_ByteString key((const FX_CHAR*)m_pSyntax->GetWordBuf() + 1, |
79 m_pSyntax->GetWordSize() - 1); | 79 m_pSyntax->GetWordSize() - 1); |
80 CPDF_Object* pObj = m_pSyntax->ReadNextObject(); | 80 nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj( |
Tom Sepez
2015/10/24 16:50:01
Is there a point at even constructing an object if
Lei Zhang
2015/10/26 21:58:22
I guess that's the only point.
| |
81 m_pSyntax->ReadNextObject()); | |
81 if (!key.IsEmpty()) { | 82 if (!key.IsEmpty()) { |
82 pDict->SetAt(key, pObj, m_pDocument); | 83 pDict->SetAtWithIndirect(key, pObj.release(), m_pDocument); |
83 } else if (pObj) { | |
84 pObj->Release(); | |
85 } | 84 } |
86 } | 85 } |
87 _PDF_ReplaceAbbr(pDict); | 86 _PDF_ReplaceAbbr(pDict); |
88 CPDF_Object* pCSObj = NULL; | 87 CPDF_Object* pCSObj = NULL; |
89 if (pDict->KeyExist(FX_BSTRC("ColorSpace"))) { | 88 if (pDict->KeyExist(FX_BSTRC("ColorSpace"))) { |
90 pCSObj = pDict->GetElementValue(FX_BSTRC("ColorSpace")); | 89 pCSObj = pDict->GetElementValue(FX_BSTRC("ColorSpace")); |
91 if (pCSObj->IsName()) { | 90 if (pCSObj->IsName()) { |
92 CFX_ByteString name = pCSObj->GetString(); | 91 CFX_ByteString name = pCSObj->GetString(); |
93 if (name != FX_BSTRC("DeviceRGB") && name != FX_BSTRC("DeviceGray") && | 92 if (name != FX_BSTRC("DeviceRGB") && name != FX_BSTRC("DeviceGray") && |
94 name != FX_BSTRC("DeviceCMYK")) { | 93 name != FX_BSTRC("DeviceCMYK")) { |
95 pCSObj = FindResourceObj(FX_BSTRC("ColorSpace"), name); | 94 pCSObj = FindResourceObj(FX_BSTRC("ColorSpace"), name); |
96 if (pCSObj && !pCSObj->GetObjNum()) { | 95 if (pCSObj && !pCSObj->GetObjNum()) { |
97 pCSObj = pCSObj->Clone(); | 96 pCSObj = pCSObj->Clone(); |
98 pDict->SetAt(FX_BSTRC("ColorSpace"), pCSObj, m_pDocument); | 97 pDict->SetAtWithIndirect(FX_BSTRC("ColorSpace"), pCSObj, m_pDocument); |
99 } | 98 } |
100 } | 99 } |
101 } | 100 } |
102 } | 101 } |
103 CPDF_Stream* pStream = m_pSyntax->ReadInlineStream( | 102 CPDF_Stream* pStream = m_pSyntax->ReadInlineStream( |
104 m_pDocument, pDict, pCSObj, m_Options.m_bDecodeInlineImage); | 103 m_pDocument, pDict, pCSObj, m_Options.m_bDecodeInlineImage); |
105 while (1) { | 104 while (1) { |
106 CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement(); | 105 CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement(); |
107 if (type == CPDF_StreamParser::EndOfData) { | 106 if (type == CPDF_StreamParser::EndOfData) { |
108 break; | 107 break; |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1141 } | 1140 } |
1142 m_Status = Done; | 1141 m_Status = Done; |
1143 return; | 1142 return; |
1144 } | 1143 } |
1145 steps++; | 1144 steps++; |
1146 if (pPause && pPause->NeedToPauseNow()) { | 1145 if (pPause && pPause->NeedToPauseNow()) { |
1147 break; | 1146 break; |
1148 } | 1147 } |
1149 } | 1148 } |
1150 } | 1149 } |
OLD | NEW |