| 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 <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 399 |
| 400 CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream) { | 400 CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream) { |
| 401 if (!pImageStream) | 401 if (!pImageStream) |
| 402 return nullptr; | 402 return nullptr; |
| 403 | 403 |
| 404 const uint32_t dwImageObjNum = pImageStream->GetObjNum(); | 404 const uint32_t dwImageObjNum = pImageStream->GetObjNum(); |
| 405 auto it = m_ImageMap.find(dwImageObjNum); | 405 auto it = m_ImageMap.find(dwImageObjNum); |
| 406 if (it != m_ImageMap.end()) | 406 if (it != m_ImageMap.end()) |
| 407 return it->second->AddRef(); | 407 return it->second->AddRef(); |
| 408 | 408 |
| 409 CPDF_Image* pImage = new CPDF_Image(m_pPDFDoc); | 409 CPDF_CountedImage* pCountedImage = new CPDF_CountedImage( |
| 410 pImage->LoadImageF(pImageStream->AsStream(), false); | 410 new CPDF_Image(m_pPDFDoc, pImageStream->AsStream(), false)); |
| 411 | |
| 412 CPDF_CountedImage* pCountedImage = new CPDF_CountedImage(pImage); | |
| 413 m_ImageMap[dwImageObjNum] = pCountedImage; | 411 m_ImageMap[dwImageObjNum] = pCountedImage; |
| 414 return pCountedImage->AddRef(); | 412 return pCountedImage->AddRef(); |
| 415 } | 413 } |
| 416 | 414 |
| 417 void CPDF_DocPageData::ReleaseImage(const CPDF_Object* pImageStream) { | 415 void CPDF_DocPageData::ReleaseImage(const CPDF_Object* pImageStream) { |
| 418 if (!pImageStream) | 416 if (!pImageStream) |
| 419 return; | 417 return; |
| 420 | 418 |
| 421 uint32_t dwObjNum = pImageStream->GetObjNum(); | 419 uint32_t dwObjNum = pImageStream->GetObjNum(); |
| 422 if (!dwObjNum) | 420 if (!dwObjNum) |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 } | 536 } |
| 539 | 537 |
| 540 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( | 538 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( |
| 541 CPDF_Object* pPatternObj) const { | 539 CPDF_Object* pPatternObj) const { |
| 542 if (!pPatternObj) | 540 if (!pPatternObj) |
| 543 return nullptr; | 541 return nullptr; |
| 544 | 542 |
| 545 auto it = m_PatternMap.find(pPatternObj); | 543 auto it = m_PatternMap.find(pPatternObj); |
| 546 return it != m_PatternMap.end() ? it->second : nullptr; | 544 return it != m_PatternMap.end() ? it->second : nullptr; |
| 547 } | 545 } |
| OLD | NEW |