Chromium Code Reviews| 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( |
| 81 m_pSyntax->ReadNextObject()); | |
| 81 if (!key.IsEmpty()) { | 82 if (!key.IsEmpty()) { |
| 82 pDict->SetAt(key, pObj, m_pDocument); | 83 FX_DWORD dwObjNum = pObj->GetObjNum(); |
| 83 } else if (pObj) { | 84 if (dwObjNum) |
| 84 pObj->Release(); | 85 pDict->SetAtReference(key, m_pDocument, dwObjNum); |
| 86 else | |
| 87 pDict->SetAt(key, pObj.release()); | |
| 85 } | 88 } |
| 86 } | 89 } |
| 87 _PDF_ReplaceAbbr(pDict); | 90 _PDF_ReplaceAbbr(pDict); |
| 88 CPDF_Object* pCSObj = NULL; | 91 CPDF_Object* pCSObj = NULL; |
| 89 if (pDict->KeyExist(FX_BSTRC("ColorSpace"))) { | 92 if (pDict->KeyExist(FX_BSTRC("ColorSpace"))) { |
| 90 pCSObj = pDict->GetElementValue(FX_BSTRC("ColorSpace")); | 93 pCSObj = pDict->GetElementValue(FX_BSTRC("ColorSpace")); |
| 91 if (pCSObj->IsName()) { | 94 if (pCSObj->IsName()) { |
| 92 CFX_ByteString name = pCSObj->GetString(); | 95 CFX_ByteString name = pCSObj->GetString(); |
| 93 if (name != FX_BSTRC("DeviceRGB") && name != FX_BSTRC("DeviceGray") && | 96 if (name != FX_BSTRC("DeviceRGB") && name != FX_BSTRC("DeviceGray") && |
| 94 name != FX_BSTRC("DeviceCMYK")) { | 97 name != FX_BSTRC("DeviceCMYK")) { |
| 95 pCSObj = FindResourceObj(FX_BSTRC("ColorSpace"), name); | 98 pCSObj = FindResourceObj(FX_BSTRC("ColorSpace"), name); |
| 96 if (pCSObj && !pCSObj->GetObjNum()) { | 99 if (pCSObj && !pCSObj->GetObjNum()) { |
|
Lei Zhang
2015/10/26 21:58:22
Since there's no object number, I would expect the
Tom Sepez
2015/10/26 22:14:00
Acknowledged.
| |
| 97 pCSObj = pCSObj->Clone(); | 100 pCSObj = pCSObj->Clone(); |
| 98 pDict->SetAt(FX_BSTRC("ColorSpace"), pCSObj, m_pDocument); | 101 pDict->SetAt(FX_BSTRC("ColorSpace"), pCSObj); |
| 99 } | 102 } |
| 100 } | 103 } |
| 101 } | 104 } |
| 102 } | 105 } |
| 103 CPDF_Stream* pStream = m_pSyntax->ReadInlineStream( | 106 CPDF_Stream* pStream = m_pSyntax->ReadInlineStream( |
| 104 m_pDocument, pDict, pCSObj, m_Options.m_bDecodeInlineImage); | 107 m_pDocument, pDict, pCSObj, m_Options.m_bDecodeInlineImage); |
| 105 while (1) { | 108 while (1) { |
| 106 CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement(); | 109 CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement(); |
| 107 if (type == CPDF_StreamParser::EndOfData) { | 110 if (type == CPDF_StreamParser::EndOfData) { |
| 108 break; | 111 break; |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1141 } | 1144 } |
| 1142 m_Status = Done; | 1145 m_Status = Done; |
| 1143 return; | 1146 return; |
| 1144 } | 1147 } |
| 1145 steps++; | 1148 steps++; |
| 1146 if (pPause && pPause->NeedToPauseNow()) { | 1149 if (pPause && pPause->NeedToPauseNow()) { |
| 1147 break; | 1150 break; |
| 1148 } | 1151 } |
| 1149 } | 1152 } |
| 1150 } | 1153 } |
| OLD | NEW |