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/fpdfapi/fpdf_serial.h" | 9 #include "../../../include/fpdfapi/fpdf_serial.h" |
10 #include "pageint.h" | 10 #include "pageint.h" |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 void CPDF_StreamContentParser::Handle_SetCachedDevice() { | 664 void CPDF_StreamContentParser::Handle_SetCachedDevice() { |
665 for (int i = 0; i < 6; i++) { | 665 for (int i = 0; i < 6; i++) { |
666 m_Type3Data[i] = GetNumber(5 - i); | 666 m_Type3Data[i] = GetNumber(5 - i); |
667 } | 667 } |
668 m_bColored = FALSE; | 668 m_bColored = FALSE; |
669 } | 669 } |
670 void CPDF_StreamContentParser::Handle_ExecuteXObject() { | 670 void CPDF_StreamContentParser::Handle_ExecuteXObject() { |
671 CFX_ByteString name = GetString(0); | 671 CFX_ByteString name = GetString(0); |
672 if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() && | 672 if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() && |
673 m_pLastImage->GetStream()->GetObjNum()) { | 673 m_pLastImage->GetStream()->GetObjNum()) { |
674 AddImage(NULL, m_pLastImage, FALSE); | 674 AddImage(nullptr, m_pLastImage, FALSE); |
675 return; | 675 return; |
676 } | 676 } |
| 677 |
677 if (m_Options.m_bTextOnly) { | 678 if (m_Options.m_bTextOnly) { |
678 CPDF_Object* pRes = NULL; | 679 if (!m_pResources) |
679 if (m_pResources == NULL) { | |
680 return; | 680 return; |
681 } | 681 |
682 if (m_pResources == m_pPageResources) { | 682 CPDF_Dictionary* pList = m_pResources->GetDict(FX_BSTRC("XObject")); |
683 CPDF_Dictionary* pList = m_pResources->GetDict(FX_BSTRC("XObject")); | 683 if (!pList && m_pPageResources && m_pResources != m_pPageResources) |
684 if (pList == NULL) { | 684 pList = m_pPageResources->GetDict(FX_BSTRC("XObject")); |
685 return; | 685 if (!pList) |
686 } | 686 return; |
687 pRes = pList->GetElement(name); | 687 CPDF_Reference* pRes = ToReference(pList->GetElement(name)); |
688 if (pRes == NULL || pRes->GetType() != PDFOBJ_REFERENCE) { | 688 if (!pRes) |
689 return; | 689 return; |
690 } | 690 |
691 } else { | |
692 CPDF_Dictionary* pList = m_pResources->GetDict(FX_BSTRC("XObject")); | |
693 if (pList == NULL) { | |
694 if (m_pPageResources == NULL) { | |
695 return; | |
696 } | |
697 CPDF_Dictionary* pList = m_pPageResources->GetDict(FX_BSTRC("XObject")); | |
698 if (pList == NULL) { | |
699 return; | |
700 } | |
701 pRes = pList->GetElement(name); | |
702 if (pRes == NULL || pRes->GetType() != PDFOBJ_REFERENCE) { | |
703 return; | |
704 } | |
705 } else { | |
706 pRes = pList->GetElement(name); | |
707 if (pRes == NULL || pRes->GetType() != PDFOBJ_REFERENCE) { | |
708 return; | |
709 } | |
710 } | |
711 } | |
712 FX_BOOL bForm; | 691 FX_BOOL bForm; |
713 if (m_pDocument->IsFormStream(((CPDF_Reference*)pRes)->GetRefObjNum(), | 692 if (m_pDocument->IsFormStream(pRes->GetRefObjNum(), bForm) && !bForm) |
714 bForm) && | |
715 !bForm) { | |
716 return; | 693 return; |
717 } | |
718 } | 694 } |
| 695 |
719 CPDF_Stream* pXObject = ToStream(FindResourceObj(FX_BSTRC("XObject"), name)); | 696 CPDF_Stream* pXObject = ToStream(FindResourceObj(FX_BSTRC("XObject"), name)); |
720 if (!pXObject) { | 697 if (!pXObject) { |
721 m_bResourceMissing = TRUE; | 698 m_bResourceMissing = TRUE; |
722 return; | 699 return; |
723 } | 700 } |
724 | 701 |
725 CFX_ByteStringC type = | 702 CFX_ByteStringC type = |
726 pXObject->GetDict() | 703 pXObject->GetDict() |
727 ? pXObject->GetDict()->GetConstString(FX_BSTRC("Subtype")) | 704 ? pXObject->GetDict()->GetConstString(FX_BSTRC("Subtype")) |
728 : CFX_ByteStringC(); | 705 : CFX_ByteStringC(); |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 buf.AppendChar((char)code); | 1563 buf.AppendChar((char)code); |
1587 } | 1564 } |
1588 bFirst = !bFirst; | 1565 bFirst = !bFirst; |
1589 } | 1566 } |
1590 } | 1567 } |
1591 if (!bFirst) { | 1568 if (!bFirst) { |
1592 buf.AppendChar((char)code); | 1569 buf.AppendChar((char)code); |
1593 } | 1570 } |
1594 return buf.GetByteString(); | 1571 return buf.GetByteString(); |
1595 } | 1572 } |
OLD | NEW |