| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_streamcontentparser.h" | 7 #include "core/fpdfapi/page/cpdf_streamcontentparser.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 if (!pStream) | 818 if (!pStream) |
| 819 return nullptr; | 819 return nullptr; |
| 820 | 820 |
| 821 auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(); | 821 auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(); |
| 822 pImageObj->SetOwnedImage( | 822 pImageObj->SetOwnedImage( |
| 823 pdfium::MakeUnique<CPDF_Image>(m_pDocument, std::move(pStream))); | 823 pdfium::MakeUnique<CPDF_Image>(m_pDocument, std::move(pStream))); |
| 824 return AddImageObject(std::move(pImageObj)); | 824 return AddImageObject(std::move(pImageObj)); |
| 825 } | 825 } |
| 826 | 826 |
| 827 CPDF_ImageObject* CPDF_StreamContentParser::AddImage(uint32_t streamObjNum) { | 827 CPDF_ImageObject* CPDF_StreamContentParser::AddImage(uint32_t streamObjNum) { |
| 828 CPDF_Stream* pStream = ToStream(m_pDocument->GetIndirectObject(streamObjNum)); | |
| 829 if (!pStream) | |
| 830 return nullptr; | |
| 831 | |
| 832 auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(); | 828 auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(); |
| 833 pImageObj->SetUnownedImage(m_pDocument->LoadImageF(pStream)); | 829 pImageObj->SetUnownedImage(m_pDocument->LoadImageFromPageData(streamObjNum)); |
| 834 return AddImageObject(std::move(pImageObj)); | 830 return AddImageObject(std::move(pImageObj)); |
| 835 } | 831 } |
| 836 | 832 |
| 837 CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Image* pImage) { | 833 CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Image* pImage) { |
| 838 if (!pImage) | 834 if (!pImage) |
| 839 return nullptr; | 835 return nullptr; |
| 840 | 836 |
| 841 auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(); | 837 auto pImageObj = pdfium::MakeUnique<CPDF_ImageObject>(); |
| 842 pImageObj->SetUnownedImage( | 838 pImageObj->SetUnownedImage( |
| 843 m_pDocument->GetPageData()->GetImage(pImage->GetStream())); | 839 m_pDocument->GetPageData()->GetImage(pImage->GetStream()->GetObjNum())); |
| 844 | 840 |
| 845 return AddImageObject(std::move(pImageObj)); | 841 return AddImageObject(std::move(pImageObj)); |
| 846 } | 842 } |
| 847 | 843 |
| 848 CPDF_ImageObject* CPDF_StreamContentParser::AddImageObject( | 844 CPDF_ImageObject* CPDF_StreamContentParser::AddImageObject( |
| 849 std::unique_ptr<CPDF_ImageObject> pImageObj) { | 845 std::unique_ptr<CPDF_ImageObject> pImageObj) { |
| 850 SetGraphicStates(pImageObj.get(), pImageObj->GetImage()->IsMask(), false, | 846 SetGraphicStates(pImageObj.get(), pImageObj->GetImage()->IsMask(), false, |
| 851 false); | 847 false); |
| 852 | 848 |
| 853 CFX_Matrix ImageMatrix = m_pCurStates->m_CTM; | 849 CFX_Matrix ImageMatrix = m_pCurStates->m_CTM; |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 } | 1661 } |
| 1666 default: | 1662 default: |
| 1667 bProcessed = false; | 1663 bProcessed = false; |
| 1668 } | 1664 } |
| 1669 if (!bProcessed) { | 1665 if (!bProcessed) { |
| 1670 m_pSyntax->SetPos(last_pos); | 1666 m_pSyntax->SetPos(last_pos); |
| 1671 return; | 1667 return; |
| 1672 } | 1668 } |
| 1673 } | 1669 } |
| 1674 } | 1670 } |
| OLD | NEW |