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/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
10 #include "pageint.h" | 10 #include "pageint.h" |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 ClipPath.Transform(&form_matrix); | 990 ClipPath.Transform(&form_matrix); |
991 if (pParentMatrix) { | 991 if (pParentMatrix) { |
992 ClipPath.Transform(pParentMatrix); | 992 ClipPath.Transform(pParentMatrix); |
993 } | 993 } |
994 form_bbox.Transform(&form_matrix); | 994 form_bbox.Transform(&form_matrix); |
995 if (pParentMatrix) { | 995 if (pParentMatrix) { |
996 form_bbox.Transform(pParentMatrix); | 996 form_bbox.Transform(pParentMatrix); |
997 } | 997 } |
998 } | 998 } |
999 CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDict(FX_BSTRC("Resource
s")); | 999 CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDict(FX_BSTRC("Resource
s")); |
1000 m_pParser = new CPDF_StreamContentParser; | 1000 m_pParser = new CPDF_StreamContentParser( |
1001 m_pParser->Initialize(); | 1001 pForm->m_pDocument, pForm->m_pPageResources, pForm->m_pResources, |
1002 m_pParser->PrepareParse(pForm->m_pDocument, pForm->m_pPageResources, pForm->
m_pResources, pParentMatrix, pForm, | 1002 pParentMatrix, pForm, pResources, &form_bbox, pOptions, pGraphicStates, |
1003 pResources, &form_bbox, pOptions, pGraphicStates, le
vel); | 1003 level); |
1004 m_pParser->m_pCurStates->m_CTM = form_matrix; | 1004 |
1005 m_pParser->m_pCurStates->m_ParentMatrix = form_matrix; | 1005 m_pParser->GetCurStates()->m_CTM = form_matrix; |
| 1006 m_pParser->GetCurStates()->m_ParentMatrix = form_matrix; |
1006 if (ClipPath.NotNull()) { | 1007 if (ClipPath.NotNull()) { |
1007 m_pParser->m_pCurStates->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING,
TRUE); | 1008 m_pParser->GetCurStates()->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDIN
G, TRUE); |
1008 } | 1009 } |
1009 if (pForm->m_Transparency & PDFTRANS_GROUP) { | 1010 if (pForm->m_Transparency & PDFTRANS_GROUP) { |
1010 CPDF_GeneralStateData* pData = m_pParser->m_pCurStates->m_GeneralState.G
etModify(); | 1011 CPDF_GeneralStateData* pData = m_pParser->GetCurStates()->m_GeneralState
.GetModify(); |
1011 pData->m_BlendType = FXDIB_BLEND_NORMAL; | 1012 pData->m_BlendType = FXDIB_BLEND_NORMAL; |
1012 pData->m_StrokeAlpha = 1.0f; | 1013 pData->m_StrokeAlpha = 1.0f; |
1013 pData->m_FillAlpha = 1.0f; | 1014 pData->m_FillAlpha = 1.0f; |
1014 pData->m_pSoftMask = NULL; | 1015 pData->m_pSoftMask = NULL; |
1015 } | 1016 } |
1016 m_nStreams = 0; | 1017 m_nStreams = 0; |
1017 m_pSingleStream = new CPDF_StreamAcc; | 1018 m_pSingleStream = new CPDF_StreamAcc; |
1018 if (pForm->m_pDocument) { | 1019 if (pForm->m_pDocument) { |
1019 m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE); | 1020 m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE); |
1020 } else { | 1021 } else { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 m_CurrentOffset = 0; | 1062 m_CurrentOffset = 0; |
1062 } else { | 1063 } else { |
1063 CPDF_Array* pContent = m_pObjects->m_pFormDict->GetArray(FX_BSTR
C("Contents")); | 1064 CPDF_Array* pContent = m_pObjects->m_pFormDict->GetArray(FX_BSTR
C("Contents")); |
1064 m_pStreamArray[m_CurrentOffset] = new CPDF_StreamAcc; | 1065 m_pStreamArray[m_CurrentOffset] = new CPDF_StreamAcc; |
1065 CPDF_Stream* pStreamObj = (CPDF_Stream*)(pContent ? pContent->Ge
tElementValue(m_CurrentOffset) : NULL); | 1066 CPDF_Stream* pStreamObj = (CPDF_Stream*)(pContent ? pContent->Ge
tElementValue(m_CurrentOffset) : NULL); |
1066 m_pStreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE); | 1067 m_pStreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE); |
1067 m_CurrentOffset ++; | 1068 m_CurrentOffset ++; |
1068 } | 1069 } |
1069 } | 1070 } |
1070 if (m_InternalStage == PAGEPARSE_STAGE_PARSE) { | 1071 if (m_InternalStage == PAGEPARSE_STAGE_PARSE) { |
1071 if (m_pParser == NULL) { | 1072 if (!m_pParser) { |
1072 m_pParser = new CPDF_StreamContentParser; | 1073 m_pParser = new CPDF_StreamContentParser( |
1073 m_pParser->Initialize(); | 1074 m_pObjects->m_pDocument, m_pObjects->m_pPageResources, |
1074 m_pParser->PrepareParse(m_pObjects->m_pDocument, m_pObjects->m_p
PageResources, NULL, NULL, m_pObjects, | 1075 nullptr, nullptr, m_pObjects, m_pObjects->m_pResources, |
1075 m_pObjects->m_pResources, &m_pObjects->m
_BBox, &m_Options, NULL, 0); | 1076 &m_pObjects->m_BBox, &m_Options, nullptr, 0); |
1076 m_pParser->m_pCurStates->m_ColorState.GetModify()->Default(); | 1077 m_pParser->GetCurStates()->m_ColorState.GetModify()->Default(); |
1077 } | 1078 } |
1078 if (m_CurrentOffset >= m_Size) { | 1079 if (m_CurrentOffset >= m_Size) { |
1079 m_InternalStage = PAGEPARSE_STAGE_CHECKCLIP; | 1080 m_InternalStage = PAGEPARSE_STAGE_CHECKCLIP; |
1080 } else { | 1081 } else { |
1081 m_CurrentOffset += m_pParser->Parse(m_pData + m_CurrentOffset, m
_Size - m_CurrentOffset, PARSE_STEP_LIMIT); | 1082 m_CurrentOffset += m_pParser->Parse(m_pData + m_CurrentOffset, m
_Size - m_CurrentOffset, PARSE_STEP_LIMIT); |
1082 if (m_pParser->m_bAbort) { | 1083 if (m_pParser->ShouldAbort()) { |
1083 m_InternalStage = PAGEPARSE_STAGE_CHECKCLIP; | 1084 m_InternalStage = PAGEPARSE_STAGE_CHECKCLIP; |
1084 continue; | 1085 continue; |
1085 } | 1086 } |
1086 } | 1087 } |
1087 } | 1088 } |
1088 if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) { | 1089 if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) { |
1089 if (m_pType3Char) { | 1090 if (m_pType3Char) { |
1090 m_pType3Char->m_bColored = m_pParser->m_bColored; | 1091 m_pType3Char->m_bColored = m_pParser->IsColored(); |
1091 m_pType3Char->m_Width = FXSYS_round(m_pParser->m_Type3Data[0] *
1000); | 1092 m_pType3Char->m_Width = FXSYS_round(m_pParser->GetType3Data()[0]
* 1000); |
1092 m_pType3Char->m_BBox.left = FXSYS_round(m_pParser->m_Type3Data[2
] * 1000); | 1093 m_pType3Char->m_BBox.left = FXSYS_round(m_pParser->GetType3Data(
)[2] * 1000); |
1093 m_pType3Char->m_BBox.bottom = FXSYS_round(m_pParser->m_Type3Data
[3] * 1000); | 1094 m_pType3Char->m_BBox.bottom = FXSYS_round(m_pParser->GetType3Dat
a()[3] * 1000); |
1094 m_pType3Char->m_BBox.right = FXSYS_round(m_pParser->m_Type3Data[
4] * 1000); | 1095 m_pType3Char->m_BBox.right = FXSYS_round(m_pParser->GetType3Data
()[4] * 1000); |
1095 m_pType3Char->m_BBox.top = FXSYS_round(m_pParser->m_Type3Data[5]
* 1000); | 1096 m_pType3Char->m_BBox.top = FXSYS_round(m_pParser->GetType3Data()
[5] * 1000); |
1096 } | 1097 } |
1097 FX_POSITION pos = m_pObjects->m_ObjectList.GetHeadPosition(); | 1098 FX_POSITION pos = m_pObjects->m_ObjectList.GetHeadPosition(); |
1098 while (pos) { | 1099 while (pos) { |
1099 CPDF_PageObject* pObj = (CPDF_PageObject*)m_pObjects->m_ObjectLi
st.GetNext(pos); | 1100 CPDF_PageObject* pObj = (CPDF_PageObject*)m_pObjects->m_ObjectLi
st.GetNext(pos); |
1100 if (pObj->m_ClipPath.IsNull()) { | 1101 if (pObj->m_ClipPath.IsNull()) { |
1101 continue; | 1102 continue; |
1102 } | 1103 } |
1103 if (pObj->m_ClipPath.GetPathCount() != 1) { | 1104 if (pObj->m_ClipPath.GetPathCount() != 1) { |
1104 continue; | 1105 continue; |
1105 } | 1106 } |
(...skipping 29 matching lines...) Expand all Loading... |
1135 return 100; | 1136 return 100; |
1136 } | 1137 } |
1137 if (m_InternalStage == PAGEPARSE_STAGE_GETCONTENT) { | 1138 if (m_InternalStage == PAGEPARSE_STAGE_GETCONTENT) { |
1138 return 10; | 1139 return 10; |
1139 } | 1140 } |
1140 if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) { | 1141 if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) { |
1141 return 90; | 1142 return 90; |
1142 } | 1143 } |
1143 return 10 + 80 * m_CurrentOffset / m_Size; | 1144 return 10 + 80 * m_CurrentOffset / m_Size; |
1144 } | 1145 } |
OLD | NEW |