| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/fpdfapi/page/cpdf_streamcontentparser.h" | 7 #include "core/fpdfapi/page/cpdf_streamcontentparser.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 m_pCurStates(new CPDF_AllStates), | 262 m_pCurStates(new CPDF_AllStates), |
| 263 m_pLastTextObject(nullptr), | 263 m_pLastTextObject(nullptr), |
| 264 m_DefFontSize(0), | 264 m_DefFontSize(0), |
| 265 m_pPathPoints(nullptr), | 265 m_pPathPoints(nullptr), |
| 266 m_PathPointCount(0), | 266 m_PathPointCount(0), |
| 267 m_PathAllocSize(0), | 267 m_PathAllocSize(0), |
| 268 m_PathCurrentX(0.0f), | 268 m_PathCurrentX(0.0f), |
| 269 m_PathCurrentY(0.0f), | 269 m_PathCurrentY(0.0f), |
| 270 m_PathClipType(0), | 270 m_PathClipType(0), |
| 271 m_pLastImage(nullptr), | 271 m_pLastImage(nullptr), |
| 272 m_pLastImageDict(nullptr), | |
| 273 m_pLastCloneImageDict(nullptr), | |
| 274 m_bColored(false), | 272 m_bColored(false), |
| 275 m_bResourceMissing(false) { | 273 m_bResourceMissing(false) { |
| 276 if (pmtContentToUser) | 274 if (pmtContentToUser) |
| 277 m_mtContentToUser = *pmtContentToUser; | 275 m_mtContentToUser = *pmtContentToUser; |
| 278 if (!m_pResources) | 276 if (!m_pResources) |
| 279 m_pResources = m_pParentResources; | 277 m_pResources = m_pParentResources; |
| 280 if (!m_pResources) | 278 if (!m_pResources) |
| 281 m_pResources = m_pPageResources; | 279 m_pResources = m_pPageResources; |
| 282 if (pBBox) | 280 if (pBBox) |
| 283 m_BBox = *pBBox; | 281 m_BBox = *pBBox; |
| 284 if (pStates) { | 282 if (pStates) { |
| 285 m_pCurStates->Copy(*pStates); | 283 m_pCurStates->Copy(*pStates); |
| 286 } else { | 284 } else { |
| 287 m_pCurStates->m_GeneralState.Emplace(); | 285 m_pCurStates->m_GeneralState.Emplace(); |
| 288 m_pCurStates->m_GraphState.Emplace(); | 286 m_pCurStates->m_GraphState.Emplace(); |
| 289 m_pCurStates->m_TextState.Emplace(); | 287 m_pCurStates->m_TextState.Emplace(); |
| 290 m_pCurStates->m_ColorState.Emplace(); | 288 m_pCurStates->m_ColorState.Emplace(); |
| 291 } | 289 } |
| 292 for (size_t i = 0; i < FX_ArraySize(m_Type3Data); ++i) { | 290 for (size_t i = 0; i < FX_ArraySize(m_Type3Data); ++i) { |
| 293 m_Type3Data[i] = 0.0; | 291 m_Type3Data[i] = 0.0; |
| 294 } | 292 } |
| 295 } | 293 } |
| 296 | 294 |
| 297 CPDF_StreamContentParser::~CPDF_StreamContentParser() { | 295 CPDF_StreamContentParser::~CPDF_StreamContentParser() { |
| 298 ClearAllParams(); | 296 ClearAllParams(); |
| 299 FX_Free(m_pPathPoints); | 297 FX_Free(m_pPathPoints); |
| 300 delete m_pLastImageDict; | |
| 301 delete m_pLastCloneImageDict; | |
| 302 } | 298 } |
| 303 | 299 |
| 304 int CPDF_StreamContentParser::GetNextParamPos() { | 300 int CPDF_StreamContentParser::GetNextParamPos() { |
| 305 if (m_ParamCount == kParamBufSize) { | 301 if (m_ParamCount == kParamBufSize) { |
| 306 m_ParamStartPos++; | 302 m_ParamStartPos++; |
| 307 if (m_ParamStartPos == kParamBufSize) { | 303 if (m_ParamStartPos == kParamBufSize) { |
| 308 m_ParamStartPos = 0; | 304 m_ParamStartPos = 0; |
| 309 } | 305 } |
| 310 if (m_ParamBuf[m_ParamStartPos].m_Type == ContentParam::OBJECT) | 306 if (m_ParamBuf[m_ParamStartPos].m_Type == ContentParam::OBJECT) |
| 311 m_ParamBuf[m_ParamStartPos].m_pObject.reset(); | 307 m_ParamBuf[m_ParamStartPos].m_pObject.reset(); |
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1663 if (!bProcessed) { | 1659 if (!bProcessed) { |
| 1664 m_pSyntax->SetPos(last_pos); | 1660 m_pSyntax->SetPos(last_pos); |
| 1665 return; | 1661 return; |
| 1666 } | 1662 } |
| 1667 } | 1663 } |
| 1668 } | 1664 } |
| 1669 | 1665 |
| 1670 CPDF_StreamContentParser::ContentParam::ContentParam() {} | 1666 CPDF_StreamContentParser::ContentParam::ContentParam() {} |
| 1671 | 1667 |
| 1672 CPDF_StreamContentParser::ContentParam::~ContentParam() {} | 1668 CPDF_StreamContentParser::ContentParam::~ContentParam() {} |
| OLD | NEW |