Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp

Issue 1414393006: Revert "Add type cast definitions for CPDF_Reference." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(nullptr, m_pLastImage, FALSE); 674 AddImage(NULL, m_pLastImage, FALSE);
675 return; 675 return;
676 } 676 }
677
678 if (m_Options.m_bTextOnly) { 677 if (m_Options.m_bTextOnly) {
679 if (!m_pResources) 678 CPDF_Object* pRes = NULL;
679 if (m_pResources == NULL) {
680 return; 680 return;
681 681 }
682 CPDF_Dictionary* pList = m_pResources->GetDict(FX_BSTRC("XObject")); 682 if (m_pResources == m_pPageResources) {
683 if (!pList && m_pPageResources && m_pResources != m_pPageResources) 683 CPDF_Dictionary* pList = m_pResources->GetDict(FX_BSTRC("XObject"));
684 pList = m_pPageResources->GetDict(FX_BSTRC("XObject")); 684 if (pList == NULL) {
685 if (!pList) 685 return;
686 }
687 pRes = pList->GetElement(name);
688 if (pRes == NULL || pRes->GetType() != PDFOBJ_REFERENCE) {
689 return;
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;
713 if (m_pDocument->IsFormStream(((CPDF_Reference*)pRes)->GetRefObjNum(),
714 bForm) &&
715 !bForm) {
686 return; 716 return;
687 CPDF_Reference* pRes = ToReference(pList->GetElement(name)); 717 }
688 if (!pRes)
689 return;
690
691 FX_BOOL bForm;
692 if (m_pDocument->IsFormStream(pRes->GetRefObjNum(), bForm) && !bForm)
693 return;
694 } 718 }
695
696 CPDF_Stream* pXObject = ToStream(FindResourceObj(FX_BSTRC("XObject"), name)); 719 CPDF_Stream* pXObject = ToStream(FindResourceObj(FX_BSTRC("XObject"), name));
697 if (!pXObject) { 720 if (!pXObject) {
698 m_bResourceMissing = TRUE; 721 m_bResourceMissing = TRUE;
699 return; 722 return;
700 } 723 }
701 724
702 CFX_ByteStringC type = 725 CFX_ByteStringC type =
703 pXObject->GetDict() 726 pXObject->GetDict()
704 ? pXObject->GetDict()->GetConstString(FX_BSTRC("Subtype")) 727 ? pXObject->GetDict()->GetConstString(FX_BSTRC("Subtype"))
705 : CFX_ByteStringC(); 728 : CFX_ByteStringC();
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 buf.AppendChar((char)code); 1586 buf.AppendChar((char)code);
1564 } 1587 }
1565 bFirst = !bFirst; 1588 bFirst = !bFirst;
1566 } 1589 }
1567 } 1590 }
1568 if (!bFirst) { 1591 if (!bFirst) {
1569 buf.AppendChar((char)code); 1592 buf.AppendChar((char)code);
1570 } 1593 }
1571 return buf.GetByteString(); 1594 return buf.GetByteString();
1572 } 1595 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698