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 "pageint.h" | 7 #include "pageint.h" |
8 | 8 |
9 #include "core/include/fpdfapi/fpdf_module.h" | 9 #include "core/include/fpdfapi/fpdf_module.h" |
10 #include "core/include/fpdfapi/fpdf_page.h" | 10 #include "core/include/fpdfapi/fpdf_page.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 m_ParamCount = 0; | 155 m_ParamCount = 0; |
156 } | 156 } |
157 CPDF_Object* CPDF_StreamContentParser::GetObject(FX_DWORD index) { | 157 CPDF_Object* CPDF_StreamContentParser::GetObject(FX_DWORD index) { |
158 if (index >= m_ParamCount) { | 158 if (index >= m_ParamCount) { |
159 return NULL; | 159 return NULL; |
160 } | 160 } |
161 int real_index = m_ParamStartPos + m_ParamCount - index - 1; | 161 int real_index = m_ParamStartPos + m_ParamCount - index - 1; |
162 if (real_index >= PARAM_BUF_SIZE) { | 162 if (real_index >= PARAM_BUF_SIZE) { |
163 real_index -= PARAM_BUF_SIZE; | 163 real_index -= PARAM_BUF_SIZE; |
164 } | 164 } |
165 _ContentParam& param = m_ParamBuf1[real_index]; | 165 ContentParam& param = m_ParamBuf1[real_index]; |
166 if (param.m_Type == PDFOBJ_NUMBER) { | 166 if (param.m_Type == PDFOBJ_NUMBER) { |
167 CPDF_Number* pNumber = param.m_Number.m_bInteger | 167 CPDF_Number* pNumber = param.m_Number.m_bInteger |
168 ? new CPDF_Number(param.m_Number.m_Integer) | 168 ? new CPDF_Number(param.m_Number.m_Integer) |
169 : new CPDF_Number(param.m_Number.m_Float); | 169 : new CPDF_Number(param.m_Number.m_Float); |
170 | 170 |
171 param.m_Type = 0; | 171 param.m_Type = 0; |
172 param.m_pObject = pNumber; | 172 param.m_pObject = pNumber; |
173 return pNumber; | 173 return pNumber; |
174 } | 174 } |
175 if (param.m_Type == PDFOBJ_NAME) { | 175 if (param.m_Type == PDFOBJ_NAME) { |
(...skipping 10 matching lines...) Expand all Loading... |
186 return NULL; | 186 return NULL; |
187 } | 187 } |
188 CFX_ByteString CPDF_StreamContentParser::GetString(FX_DWORD index) { | 188 CFX_ByteString CPDF_StreamContentParser::GetString(FX_DWORD index) { |
189 if (index >= m_ParamCount) { | 189 if (index >= m_ParamCount) { |
190 return CFX_ByteString(); | 190 return CFX_ByteString(); |
191 } | 191 } |
192 int real_index = m_ParamStartPos + m_ParamCount - index - 1; | 192 int real_index = m_ParamStartPos + m_ParamCount - index - 1; |
193 if (real_index >= PARAM_BUF_SIZE) { | 193 if (real_index >= PARAM_BUF_SIZE) { |
194 real_index -= PARAM_BUF_SIZE; | 194 real_index -= PARAM_BUF_SIZE; |
195 } | 195 } |
196 _ContentParam& param = m_ParamBuf1[real_index]; | 196 ContentParam& param = m_ParamBuf1[real_index]; |
197 if (param.m_Type == PDFOBJ_NAME) { | 197 if (param.m_Type == PDFOBJ_NAME) { |
198 return CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len); | 198 return CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len); |
199 } | 199 } |
200 if (param.m_Type == 0 && param.m_pObject) { | 200 if (param.m_Type == 0 && param.m_pObject) { |
201 return param.m_pObject->GetString(); | 201 return param.m_pObject->GetString(); |
202 } | 202 } |
203 return CFX_ByteString(); | 203 return CFX_ByteString(); |
204 } | 204 } |
205 FX_FLOAT CPDF_StreamContentParser::GetNumber(FX_DWORD index) { | 205 FX_FLOAT CPDF_StreamContentParser::GetNumber(FX_DWORD index) { |
206 if (index >= m_ParamCount) { | 206 if (index >= m_ParamCount) { |
207 return 0; | 207 return 0; |
208 } | 208 } |
209 int real_index = m_ParamStartPos + m_ParamCount - index - 1; | 209 int real_index = m_ParamStartPos + m_ParamCount - index - 1; |
210 if (real_index >= PARAM_BUF_SIZE) { | 210 if (real_index >= PARAM_BUF_SIZE) { |
211 real_index -= PARAM_BUF_SIZE; | 211 real_index -= PARAM_BUF_SIZE; |
212 } | 212 } |
213 _ContentParam& param = m_ParamBuf1[real_index]; | 213 ContentParam& param = m_ParamBuf1[real_index]; |
214 if (param.m_Type == PDFOBJ_NUMBER) { | 214 if (param.m_Type == PDFOBJ_NUMBER) { |
215 return param.m_Number.m_bInteger ? (FX_FLOAT)param.m_Number.m_Integer | 215 return param.m_Number.m_bInteger ? (FX_FLOAT)param.m_Number.m_Integer |
216 : param.m_Number.m_Float; | 216 : param.m_Number.m_Float; |
217 } | 217 } |
218 if (param.m_Type == 0 && param.m_pObject) { | 218 if (param.m_Type == 0 && param.m_pObject) { |
219 return param.m_pObject->GetNumber(); | 219 return param.m_pObject->GetNumber(); |
220 } | 220 } |
221 return 0; | 221 return 0; |
222 } | 222 } |
223 FX_FLOAT CPDF_StreamContentParser::GetNumber16(FX_DWORD index) { | 223 FX_FLOAT CPDF_StreamContentParser::GetNumber16(FX_DWORD index) { |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 m_pObjectList->m_ObjectList.AddTail(pPathObj); | 1520 m_pObjectList->m_ObjectList.AddTail(pPathObj); |
1521 } | 1521 } |
1522 if (PathClipType) { | 1522 if (PathClipType) { |
1523 if (!matrix.IsIdentity()) { | 1523 if (!matrix.IsIdentity()) { |
1524 Path.Transform(&matrix); | 1524 Path.Transform(&matrix); |
1525 matrix.SetIdentity(); | 1525 matrix.SetIdentity(); |
1526 } | 1526 } |
1527 m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE); | 1527 m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE); |
1528 } | 1528 } |
1529 } | 1529 } |
OLD | NEW |