| 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_pageobj.h" | 8 #include "../../../include/fpdfapi/fpdf_pageobj.h" |
| 9 #include "../../../include/fpdfapi/fpdf_module.h" | 9 #include "../../../include/fpdfapi/fpdf_module.h" |
| 10 #include "../../../include/fpdfapi/fpdf_render.h" | 10 #include "../../../include/fpdfapi/fpdf_render.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 CPDF_ClipPathData::CPDF_ClipPathData() { | 24 CPDF_ClipPathData::CPDF_ClipPathData() { |
| 25 m_PathCount = 0; | 25 m_PathCount = 0; |
| 26 m_pPathList = NULL; | 26 m_pPathList = NULL; |
| 27 m_pTypeList = NULL; | 27 m_pTypeList = NULL; |
| 28 m_TextCount = 0; | 28 m_TextCount = 0; |
| 29 m_pTextList = NULL; | 29 m_pTextList = NULL; |
| 30 } | 30 } |
| 31 CPDF_ClipPathData::~CPDF_ClipPathData() { | 31 CPDF_ClipPathData::~CPDF_ClipPathData() { |
| 32 int i; | 32 int i; |
| 33 delete[] m_pPathList; | 33 delete[] m_pPathList; |
| 34 if (m_pTypeList) { | 34 FX_Free(m_pTypeList); |
| 35 FX_Free(m_pTypeList); | |
| 36 } | |
| 37 for (i = m_TextCount - 1; i > -1; i--) | 35 for (i = m_TextCount - 1; i > -1; i--) |
| 38 delete m_pTextList[i]; | 36 delete m_pTextList[i]; |
| 39 if (m_pTextList) { | 37 FX_Free(m_pTextList); |
| 40 FX_Free(m_pTextList); | |
| 41 } | |
| 42 } | 38 } |
| 43 CPDF_ClipPathData::CPDF_ClipPathData(const CPDF_ClipPathData& src) { | 39 CPDF_ClipPathData::CPDF_ClipPathData(const CPDF_ClipPathData& src) { |
| 44 m_pPathList = NULL; | 40 m_pPathList = NULL; |
| 45 m_pPathList = NULL; | 41 m_pPathList = NULL; |
| 46 m_pTextList = NULL; | 42 m_pTextList = NULL; |
| 47 m_PathCount = src.m_PathCount; | 43 m_PathCount = src.m_PathCount; |
| 48 if (m_PathCount) { | 44 if (m_PathCount) { |
| 49 int alloc_size = m_PathCount; | 45 int alloc_size = m_PathCount; |
| 50 if (alloc_size % 8) { | 46 if (alloc_size % 8) { |
| 51 alloc_size += 8 - (alloc_size % 8); | 47 alloc_size += 8 - (alloc_size % 8); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 137 } |
| 142 } | 138 } |
| 143 if (pData->m_PathCount % 8 == 0) { | 139 if (pData->m_PathCount % 8 == 0) { |
| 144 CPDF_Path* pNewPath = new CPDF_Path[pData->m_PathCount + 8]; | 140 CPDF_Path* pNewPath = new CPDF_Path[pData->m_PathCount + 8]; |
| 145 for (int i = 0; i < pData->m_PathCount; i++) { | 141 for (int i = 0; i < pData->m_PathCount; i++) { |
| 146 pNewPath[i] = pData->m_pPathList[i]; | 142 pNewPath[i] = pData->m_pPathList[i]; |
| 147 } | 143 } |
| 148 delete[] pData->m_pPathList; | 144 delete[] pData->m_pPathList; |
| 149 uint8_t* pNewType = FX_Alloc(uint8_t, pData->m_PathCount + 8); | 145 uint8_t* pNewType = FX_Alloc(uint8_t, pData->m_PathCount + 8); |
| 150 FXSYS_memcpy(pNewType, pData->m_pTypeList, pData->m_PathCount); | 146 FXSYS_memcpy(pNewType, pData->m_pTypeList, pData->m_PathCount); |
| 151 if (pData->m_pTypeList) { | 147 FX_Free(pData->m_pTypeList); |
| 152 FX_Free(pData->m_pTypeList); | |
| 153 } | |
| 154 pData->m_pPathList = pNewPath; | 148 pData->m_pPathList = pNewPath; |
| 155 pData->m_pTypeList = pNewType; | 149 pData->m_pTypeList = pNewType; |
| 156 } | 150 } |
| 157 pData->m_pPathList[pData->m_PathCount] = path; | 151 pData->m_pPathList[pData->m_PathCount] = path; |
| 158 pData->m_pTypeList[pData->m_PathCount] = (uint8_t)type; | 152 pData->m_pTypeList[pData->m_PathCount] = (uint8_t)type; |
| 159 pData->m_PathCount++; | 153 pData->m_PathCount++; |
| 160 } | 154 } |
| 161 void CPDF_ClipPath::DeletePath(int index) { | 155 void CPDF_ClipPath::DeletePath(int index) { |
| 162 CPDF_ClipPathData* pData = GetModify(); | 156 CPDF_ClipPathData* pData = GetModify(); |
| 163 if (index >= pData->m_PathCount) { | 157 if (index >= pData->m_PathCount) { |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 pDict = NULL; | 677 pDict = NULL; |
| 684 if (item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict || | 678 if (item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict || |
| 685 item.GetParamType() == CPDF_ContentMarkItem::DirectDict) { | 679 item.GetParamType() == CPDF_ContentMarkItem::DirectDict) { |
| 686 pDict = (CPDF_Dictionary*)item.GetParam(); | 680 pDict = (CPDF_Dictionary*)item.GetParam(); |
| 687 } | 681 } |
| 688 return TRUE; | 682 return TRUE; |
| 689 } | 683 } |
| 690 } | 684 } |
| 691 return FALSE; | 685 return FALSE; |
| 692 } | 686 } |
| OLD | NEW |