| 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 <memory> | 
 |    10 #include <utility> | 
|     9 #include <vector> |    11 #include <vector> | 
|    10  |    12  | 
|    11 #include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" |    13 #include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" | 
|    12 #include "core/fpdfapi/fpdf_font/cpdf_type3font.h" |    14 #include "core/fpdfapi/fpdf_font/cpdf_type3font.h" | 
|    13 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |    15 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 
|    14 #include "core/fpdfapi/fpdf_page/cpdf_allstates.h" |    16 #include "core/fpdfapi/fpdf_page/cpdf_allstates.h" | 
|    15 #include "core/fpdfapi/fpdf_page/cpdf_meshstream.h" |    17 #include "core/fpdfapi/fpdf_page/cpdf_meshstream.h" | 
|    16 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" |    18 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" | 
|    17 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" |    19 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" | 
|    18 #include "core/fpdfapi/fpdf_page/include/cpdf_formobject.h" |    20 #include "core/fpdfapi/fpdf_page/include/cpdf_formobject.h" | 
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   636     } |   638     } | 
|   637     if (type != CPDF_StreamParser::Keyword) { |   639     if (type != CPDF_StreamParser::Keyword) { | 
|   638       continue; |   640       continue; | 
|   639     } |   641     } | 
|   640     if (m_pSyntax->GetWordSize() == 2 && m_pSyntax->GetWordBuf()[0] == 'E' && |   642     if (m_pSyntax->GetWordSize() == 2 && m_pSyntax->GetWordBuf()[0] == 'E' && | 
|   641         m_pSyntax->GetWordBuf()[1] == 'I') { |   643         m_pSyntax->GetWordBuf()[1] == 'I') { | 
|   642       break; |   644       break; | 
|   643     } |   645     } | 
|   644   } |   646   } | 
|   645   pDict->SetAtName("Subtype", "Image"); |   647   pDict->SetAtName("Subtype", "Image"); | 
|   646   CPDF_ImageObject* pImgObj = AddImage(pStream, nullptr, TRUE); |   648   CPDF_ImageObject* pImgObj = AddImage(pStream, nullptr, true); | 
|   647   if (!pImgObj) { |   649   if (!pImgObj) { | 
|   648     if (pStream) { |   650     if (pStream) { | 
|   649       pStream->Release(); |   651       pStream->Release(); | 
|   650     } else { |   652     } else { | 
|   651       pDict->Release(); |   653       pDict->Release(); | 
|   652     } |   654     } | 
|   653   } |   655   } | 
|   654 } |   656 } | 
|   655  |   657  | 
|   656 void CPDF_StreamContentParser::Handle_BeginMarkedContent() { |   658 void CPDF_StreamContentParser::Handle_BeginMarkedContent() { | 
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   717   for (int i = 0; i < 6; i++) { |   719   for (int i = 0; i < 6; i++) { | 
|   718     m_Type3Data[i] = GetNumber(5 - i); |   720     m_Type3Data[i] = GetNumber(5 - i); | 
|   719   } |   721   } | 
|   720   m_bColored = FALSE; |   722   m_bColored = FALSE; | 
|   721 } |   723 } | 
|   722  |   724  | 
|   723 void CPDF_StreamContentParser::Handle_ExecuteXObject() { |   725 void CPDF_StreamContentParser::Handle_ExecuteXObject() { | 
|   724   CFX_ByteString name = GetString(0); |   726   CFX_ByteString name = GetString(0); | 
|   725   if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() && |   727   if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() && | 
|   726       m_pLastImage->GetStream()->GetObjNum()) { |   728       m_pLastImage->GetStream()->GetObjNum()) { | 
|   727     AddImage(nullptr, m_pLastImage, FALSE); |   729     AddImage(nullptr, m_pLastImage, false); | 
|   728     return; |   730     return; | 
|   729   } |   731   } | 
|   730  |   732  | 
|   731   CPDF_Stream* pXObject = ToStream(FindResourceObj("XObject", name)); |   733   CPDF_Stream* pXObject = ToStream(FindResourceObj("XObject", name)); | 
|   732   if (!pXObject) { |   734   if (!pXObject) { | 
|   733     m_bResourceMissing = TRUE; |   735     m_bResourceMissing = TRUE; | 
|   734     return; |   736     return; | 
|   735   } |   737   } | 
|   736  |   738  | 
|   737   CFX_ByteString type; |   739   CFX_ByteString type; | 
|   738   if (pXObject->GetDict()) |   740   if (pXObject->GetDict()) | 
|   739     type = pXObject->GetDict()->GetStringBy("Subtype"); |   741     type = pXObject->GetDict()->GetStringBy("Subtype"); | 
|   740  |   742  | 
|   741   if (type == "Image") { |   743   if (type == "Image") { | 
|   742     CPDF_ImageObject* pObj = AddImage(pXObject, nullptr, FALSE); |   744     CPDF_ImageObject* pObj = AddImage(pXObject, nullptr, false); | 
|   743     m_LastImageName = name; |   745     m_LastImageName = name; | 
|   744     m_pLastImage = pObj->m_pImage; |   746     m_pLastImage = pObj->m_pImage; | 
|   745     if (!m_pObjectHolder->HasImageMask()) |   747     if (!m_pObjectHolder->HasImageMask()) | 
|   746       m_pObjectHolder->SetHasImageMask(m_pLastImage->IsMask()); |   748       m_pObjectHolder->SetHasImageMask(m_pLastImage->IsMask()); | 
|   747   } else if (type == "Form") { |   749   } else if (type == "Form") { | 
|   748     AddForm(pXObject); |   750     AddForm(pXObject); | 
|   749   } |   751   } | 
|   750 } |   752 } | 
|   751  |   753  | 
|   752 void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) { |   754 void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) { | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
|   765       pFormObj->m_pForm->BackgroundAlphaNeeded()) { |   767       pFormObj->m_pForm->BackgroundAlphaNeeded()) { | 
|   766     m_pObjectHolder->SetBackgroundAlphaNeeded(TRUE); |   768     m_pObjectHolder->SetBackgroundAlphaNeeded(TRUE); | 
|   767   } |   769   } | 
|   768   pFormObj->CalcBoundingBox(); |   770   pFormObj->CalcBoundingBox(); | 
|   769   SetGraphicStates(pFormObj.get(), TRUE, TRUE, TRUE); |   771   SetGraphicStates(pFormObj.get(), TRUE, TRUE, TRUE); | 
|   770   m_pObjectHolder->GetPageObjectList()->push_back(std::move(pFormObj)); |   772   m_pObjectHolder->GetPageObjectList()->push_back(std::move(pFormObj)); | 
|   771 } |   773 } | 
|   772  |   774  | 
|   773 CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, |   775 CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, | 
|   774                                                      CPDF_Image* pImage, |   776                                                      CPDF_Image* pImage, | 
|   775                                                      FX_BOOL bInline) { |   777                                                      bool bInline) { | 
|   776   if (!pStream && !pImage) { |   778   if (!pStream && !pImage) | 
|   777     return nullptr; |   779     return nullptr; | 
|   778   } |   780  | 
|   779   CFX_Matrix ImageMatrix; |   781   CFX_Matrix ImageMatrix; | 
|   780   ImageMatrix.Copy(m_pCurStates->m_CTM); |   782   ImageMatrix.Copy(m_pCurStates->m_CTM); | 
|   781   ImageMatrix.Concat(m_mtContentToUser); |   783   ImageMatrix.Concat(m_mtContentToUser); | 
|   782  |   784  | 
|   783   std::unique_ptr<CPDF_ImageObject> pImageObj(new CPDF_ImageObject); |   785   std::unique_ptr<CPDF_ImageObject> pImageObj(new CPDF_ImageObject); | 
|   784   if (pImage) { |   786   if (pImage) { | 
|   785     pImageObj->m_pImage = |   787     pImageObj->m_pImage = | 
|   786         m_pDocument->GetPageData()->GetImage(pImage->GetStream()); |   788         m_pDocument->GetPageData()->GetImage(pImage->GetStream()); | 
|   787   } else if (pStream->GetObjNum()) { |   789   } else if (pStream->GetObjNum()) { | 
|   788     pImageObj->m_pImage = m_pDocument->LoadImageF(pStream); |   790     pImageObj->m_pImage = m_pDocument->LoadImageF(pStream); | 
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1681         } else { |  1683         } else { | 
|  1682           PDF_ReplaceAbbr(pElement); |  1684           PDF_ReplaceAbbr(pElement); | 
|  1683         } |  1685         } | 
|  1684       } |  1686       } | 
|  1685       break; |  1687       break; | 
|  1686     } |  1688     } | 
|  1687     default: |  1689     default: | 
|  1688       break; |  1690       break; | 
|  1689   } |  1691   } | 
|  1690 } |  1692 } | 
| OLD | NEW |