| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 for (int i = 0; i < FX_ArraySize(m_Type3Data); ++i) { | 76 for (int i = 0; i < FX_ArraySize(m_Type3Data); ++i) { |
| 77 m_Type3Data[i] = 0.0; | 77 m_Type3Data[i] = 0.0; |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 CPDF_StreamContentParser::~CPDF_StreamContentParser() { | 81 CPDF_StreamContentParser::~CPDF_StreamContentParser() { |
| 82 ClearAllParams(); | 82 ClearAllParams(); |
| 83 for (int i = 0; i < m_StateStack.GetSize(); ++i) { | 83 for (int i = 0; i < m_StateStack.GetSize(); ++i) { |
| 84 delete (CPDF_AllStates*)m_StateStack[i]; | 84 delete (CPDF_AllStates*)m_StateStack[i]; |
| 85 } | 85 } |
| 86 if (m_pPathPoints) { | |
| 87 FX_Free(m_pPathPoints); | 86 FX_Free(m_pPathPoints); |
| 88 } | |
| 89 if (m_pLastImageDict) { | 87 if (m_pLastImageDict) { |
| 90 m_pLastImageDict->Release(); | 88 m_pLastImageDict->Release(); |
| 91 } | 89 } |
| 92 if (m_pLastCloneImageDict) { | 90 if (m_pLastCloneImageDict) { |
| 93 m_pLastCloneImageDict->Release(); | 91 m_pLastCloneImageDict->Release(); |
| 94 } | 92 } |
| 95 } | 93 } |
| 96 int CPDF_StreamContentParser::GetNextParamPos() { | 94 int CPDF_StreamContentParser::GetNextParamPos() { |
| 97 if (m_ParamCount == PARAM_BUF_SIZE) { | 95 if (m_ParamCount == PARAM_BUF_SIZE) { |
| 98 m_ParamStartPos++; | 96 m_ParamStartPos++; |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 } | 1078 } |
| 1081 } | 1079 } |
| 1082 if (nvalues != nargs) { | 1080 if (nvalues != nargs) { |
| 1083 CPDF_Pattern* pPattern = FindPattern(GetString(0), FALSE); | 1081 CPDF_Pattern* pPattern = FindPattern(GetString(0), FALSE); |
| 1084 if (pPattern) { | 1082 if (pPattern) { |
| 1085 m_pCurStates->m_ColorState.SetFillPattern(pPattern, values, nvalues); | 1083 m_pCurStates->m_ColorState.SetFillPattern(pPattern, values, nvalues); |
| 1086 } | 1084 } |
| 1087 } else { | 1085 } else { |
| 1088 m_pCurStates->m_ColorState.SetFillColor(NULL, values, nvalues); | 1086 m_pCurStates->m_ColorState.SetFillColor(NULL, values, nvalues); |
| 1089 } | 1087 } |
| 1090 if (values) { | |
| 1091 FX_Free(values); | 1088 FX_Free(values); |
| 1092 } | |
| 1093 } | 1089 } |
| 1094 void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() { | 1090 void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() { |
| 1095 if (m_Options.m_bTextOnly) { | 1091 if (m_Options.m_bTextOnly) { |
| 1096 return; | 1092 return; |
| 1097 } | 1093 } |
| 1098 CPDF_Object* pLastParam = GetObject(0); | 1094 CPDF_Object* pLastParam = GetObject(0); |
| 1099 if (pLastParam == NULL) { | 1095 if (pLastParam == NULL) { |
| 1100 return; | 1096 return; |
| 1101 } | 1097 } |
| 1102 int nargs = m_ParamCount; | 1098 int nargs = m_ParamCount; |
| 1103 int nvalues = nargs; | 1099 int nvalues = nargs; |
| 1104 if (pLastParam->GetType() == PDFOBJ_NAME) { | 1100 if (pLastParam->GetType() == PDFOBJ_NAME) { |
| 1105 nvalues--; | 1101 nvalues--; |
| 1106 } | 1102 } |
| 1107 FX_FLOAT* values = NULL; | 1103 FX_FLOAT* values = NULL; |
| 1108 if (nvalues) { | 1104 if (nvalues) { |
| 1109 values = FX_Alloc(FX_FLOAT, nvalues); | 1105 values = FX_Alloc(FX_FLOAT, nvalues); |
| 1110 for (int i = 0; i < nvalues; i++) { | 1106 for (int i = 0; i < nvalues; i++) { |
| 1111 values[i] = GetNumber(nargs - i - 1); | 1107 values[i] = GetNumber(nargs - i - 1); |
| 1112 } | 1108 } |
| 1113 } | 1109 } |
| 1114 if (nvalues != nargs) { | 1110 if (nvalues != nargs) { |
| 1115 CPDF_Pattern* pPattern = FindPattern(GetString(0), FALSE); | 1111 CPDF_Pattern* pPattern = FindPattern(GetString(0), FALSE); |
| 1116 if (pPattern) { | 1112 if (pPattern) { |
| 1117 m_pCurStates->m_ColorState.SetStrokePattern(pPattern, values, nvalues); | 1113 m_pCurStates->m_ColorState.SetStrokePattern(pPattern, values, nvalues); |
| 1118 } | 1114 } |
| 1119 } else { | 1115 } else { |
| 1120 m_pCurStates->m_ColorState.SetStrokeColor(NULL, values, nvalues); | 1116 m_pCurStates->m_ColorState.SetStrokeColor(NULL, values, nvalues); |
| 1121 } | 1117 } |
| 1122 if (values) { | |
| 1123 FX_Free(values); | 1118 FX_Free(values); |
| 1124 } | |
| 1125 } | 1119 } |
| 1126 CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream, | 1120 CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream, |
| 1127 int type, | 1121 int type, |
| 1128 const CFX_AffineMatrix* pMatrix, | 1122 const CFX_AffineMatrix* pMatrix, |
| 1129 CPDF_Function** pFuncs, | 1123 CPDF_Function** pFuncs, |
| 1130 int nFuncs, | 1124 int nFuncs, |
| 1131 CPDF_ColorSpace* pCS); | 1125 CPDF_ColorSpace* pCS); |
| 1132 void CPDF_StreamContentParser::Handle_ShadeFill() { | 1126 void CPDF_StreamContentParser::Handle_ShadeFill() { |
| 1133 if (m_Options.m_bTextOnly) { | 1127 if (m_Options.m_bTextOnly) { |
| 1134 return; | 1128 return; |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1595 buf.AppendChar((char)code); | 1589 buf.AppendChar((char)code); |
| 1596 } | 1590 } |
| 1597 bFirst = !bFirst; | 1591 bFirst = !bFirst; |
| 1598 } | 1592 } |
| 1599 } | 1593 } |
| 1600 if (!bFirst) { | 1594 if (!bFirst) { |
| 1601 buf.AppendChar((char)code); | 1595 buf.AppendChar((char)code); |
| 1602 } | 1596 } |
| 1603 return buf.GetByteString(); | 1597 return buf.GetByteString(); |
| 1604 } | 1598 } |
| OLD | NEW |