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

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

Issue 1422513004: Merge to XFA: Add type cast definitions for CPDF_Stream. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 } 709 }
710 } 710 }
711 } 711 }
712 FX_BOOL bForm; 712 FX_BOOL bForm;
713 if (m_pDocument->IsFormStream(((CPDF_Reference*)pRes)->GetRefObjNum(), 713 if (m_pDocument->IsFormStream(((CPDF_Reference*)pRes)->GetRefObjNum(),
714 bForm) && 714 bForm) &&
715 !bForm) { 715 !bForm) {
716 return; 716 return;
717 } 717 }
718 } 718 }
719 CPDF_Stream* pXObject = 719 CPDF_Stream* pXObject = ToStream(FindResourceObj(FX_BSTRC("XObject"), name));
720 (CPDF_Stream*)FindResourceObj(FX_BSTRC("XObject"), name); 720 if (!pXObject) {
721 if (pXObject == NULL || pXObject->GetType() != PDFOBJ_STREAM) {
722 m_bResourceMissing = TRUE; 721 m_bResourceMissing = TRUE;
723 return; 722 return;
724 } 723 }
724
725 CFX_ByteStringC type = 725 CFX_ByteStringC type =
726 pXObject->GetDict() 726 pXObject->GetDict()
727 ? pXObject->GetDict()->GetConstString(FX_BSTRC("Subtype")) 727 ? pXObject->GetDict()->GetConstString(FX_BSTRC("Subtype"))
728 : CFX_ByteStringC(); 728 : CFX_ByteStringC();
729 if (type == FX_BSTRC("Image")) { 729 if (type == FX_BSTRC("Image")) {
730 if (m_Options.m_bTextOnly) { 730 if (m_Options.m_bTextOnly) {
731 return; 731 return;
732 } 732 }
733 CPDF_ImageObject* pObj = AddImage(pXObject, NULL, FALSE); 733 CPDF_ImageObject* pObj = AddImage(pXObject, NULL, FALSE);
734 m_LastImageName = name; 734 m_LastImageName = name;
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 SetGraphicStates(pObj, FALSE, FALSE, FALSE); 1144 SetGraphicStates(pObj, FALSE, FALSE, FALSE);
1145 pObj->m_Matrix = m_pCurStates->m_CTM; 1145 pObj->m_Matrix = m_pCurStates->m_CTM;
1146 pObj->m_Matrix.Concat(m_mtContentToUser); 1146 pObj->m_Matrix.Concat(m_mtContentToUser);
1147 CFX_FloatRect bbox; 1147 CFX_FloatRect bbox;
1148 if (!pObj->m_ClipPath.IsNull()) { 1148 if (!pObj->m_ClipPath.IsNull()) {
1149 bbox = pObj->m_ClipPath.GetClipBox(); 1149 bbox = pObj->m_ClipPath.GetClipBox();
1150 } else { 1150 } else {
1151 bbox = m_BBox; 1151 bbox = m_BBox;
1152 } 1152 }
1153 if (pShading->m_ShadingType >= 4) { 1153 if (pShading->m_ShadingType >= 4) {
1154 bbox.Intersect(_GetShadingBBox((CPDF_Stream*)pShading->m_pShadingObj, 1154 bbox.Intersect(_GetShadingBBox(ToStream(pShading->m_pShadingObj),
1155 pShading->m_ShadingType, &pObj->m_Matrix, 1155 pShading->m_ShadingType, &pObj->m_Matrix,
1156 pShading->m_pFunctions, pShading->m_nFuncs, 1156 pShading->m_pFunctions, pShading->m_nFuncs,
1157 pShading->m_pCS)); 1157 pShading->m_pCS));
1158 } 1158 }
1159 pObj->m_Left = bbox.left; 1159 pObj->m_Left = bbox.left;
1160 pObj->m_Right = bbox.right; 1160 pObj->m_Right = bbox.right;
1161 pObj->m_Top = bbox.top; 1161 pObj->m_Top = bbox.top;
1162 pObj->m_Bottom = bbox.bottom; 1162 pObj->m_Bottom = bbox.bottom;
1163 m_pObjectList->m_ObjectList.AddTail(pObj); 1163 m_pObjectList->m_ObjectList.AddTail(pObj);
1164 } 1164 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 if (pCSObj == NULL) { 1255 if (pCSObj == NULL) {
1256 m_bResourceMissing = TRUE; 1256 m_bResourceMissing = TRUE;
1257 return NULL; 1257 return NULL;
1258 } 1258 }
1259 return m_pDocument->LoadColorSpace(pCSObj); 1259 return m_pDocument->LoadColorSpace(pCSObj);
1260 } 1260 }
1261 CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name, 1261 CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name,
1262 FX_BOOL bShading) { 1262 FX_BOOL bShading) {
1263 CPDF_Object* pPattern = FindResourceObj( 1263 CPDF_Object* pPattern = FindResourceObj(
1264 bShading ? FX_BSTRC("Shading") : FX_BSTRC("Pattern"), name); 1264 bShading ? FX_BSTRC("Shading") : FX_BSTRC("Pattern"), name);
1265 if (pPattern == NULL || 1265 if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream())) {
1266 (!pPattern->IsDictionary() && pPattern->GetType() != PDFOBJ_STREAM)) {
1267 m_bResourceMissing = TRUE; 1266 m_bResourceMissing = TRUE;
1268 return NULL; 1267 return NULL;
1269 } 1268 }
1270 return m_pDocument->LoadPattern(pPattern, bShading, 1269 return m_pDocument->LoadPattern(pPattern, bShading,
1271 &m_pCurStates->m_ParentMatrix); 1270 &m_pCurStates->m_ParentMatrix);
1272 } 1271 }
1273 void CPDF_StreamContentParser::ConvertTextSpace(FX_FLOAT& x, FX_FLOAT& y) { 1272 void CPDF_StreamContentParser::ConvertTextSpace(FX_FLOAT& x, FX_FLOAT& y) {
1274 m_pCurStates->m_TextMatrix.Transform(x, y, x, y); 1273 m_pCurStates->m_TextMatrix.Transform(x, y, x, y);
1275 ConvertUserSpace(x, y); 1274 ConvertUserSpace(x, y);
1276 } 1275 }
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 buf.AppendChar((char)code); 1586 buf.AppendChar((char)code);
1588 } 1587 }
1589 bFirst = !bFirst; 1588 bFirst = !bFirst;
1590 } 1589 }
1591 } 1590 }
1592 if (!bFirst) { 1591 if (!bFirst) {
1593 buf.AppendChar((char)code); 1592 buf.AppendChar((char)code);
1594 } 1593 }
1595 return buf.GetByteString(); 1594 return buf.GetByteString();
1596 } 1595 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698