| 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/page/cpdf_docpagedata.h" | 7 #include "core/fpdfapi/page/cpdf_docpagedata.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 return; | 390 return; |
| 391 | 391 |
| 392 // We have item only in m_PatternMap cache. Clean it. | 392 // We have item only in m_PatternMap cache. Clean it. |
| 393 pPattern->clear(); | 393 pPattern->clear(); |
| 394 } | 394 } |
| 395 | 395 |
| 396 CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream) { | 396 CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream) { |
| 397 if (!pImageStream) | 397 if (!pImageStream) |
| 398 return nullptr; | 398 return nullptr; |
| 399 | 399 |
| 400 const uint32_t dwImageObjNum = pImageStream->GetObjNum(); | 400 ASSERT(!pImageStream->IsInline()); |
| 401 auto it = m_ImageMap.find(dwImageObjNum); | 401 const uint32_t dwObjNum = pImageStream->GetObjNum(); |
| 402 auto it = m_ImageMap.find(dwObjNum); |
| 402 if (it != m_ImageMap.end()) | 403 if (it != m_ImageMap.end()) |
| 403 return it->second->AddRef(); | 404 return it->second->AddRef(); |
| 404 | 405 |
| 405 CPDF_CountedImage* pCountedImage = new CPDF_CountedImage( | 406 CPDF_CountedImage* pCountedImage = |
| 406 new CPDF_Image(m_pPDFDoc, pImageStream->AsStream(), false)); | 407 new CPDF_CountedImage(new CPDF_Image(m_pPDFDoc, dwObjNum)); |
| 407 m_ImageMap[dwImageObjNum] = pCountedImage; | 408 m_ImageMap[dwObjNum] = pCountedImage; |
| 408 return pCountedImage->AddRef(); | 409 return pCountedImage->AddRef(); |
| 409 } | 410 } |
| 410 | 411 |
| 411 void CPDF_DocPageData::ReleaseImage(const CPDF_Object* pImageStream) { | 412 void CPDF_DocPageData::ReleaseImage(const CPDF_Object* pImageStream) { |
| 412 if (!pImageStream) | 413 if (!pImageStream) |
| 413 return; | 414 return; |
| 414 | 415 |
| 415 uint32_t dwObjNum = pImageStream->GetObjNum(); | 416 uint32_t dwObjNum = pImageStream->GetObjNum(); |
| 416 if (!dwObjNum) | 417 if (!dwObjNum) |
| 417 return; | 418 return; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 } | 537 } |
| 537 | 538 |
| 538 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( | 539 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( |
| 539 CPDF_Object* pPatternObj) const { | 540 CPDF_Object* pPatternObj) const { |
| 540 if (!pPatternObj) | 541 if (!pPatternObj) |
| 541 return nullptr; | 542 return nullptr; |
| 542 | 543 |
| 543 auto it = m_PatternMap.find(pPatternObj); | 544 auto it = m_PatternMap.find(pPatternObj); |
| 544 return it != m_PatternMap.end() ? it->second : nullptr; | 545 return it != m_PatternMap.end() ? it->second : nullptr; |
| 545 } | 546 } |
| OLD | NEW |