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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 m_pTypeList = FX_Alloc(FX_BYTE, alloc_size); | 65 m_pTypeList = FX_Alloc(FX_BYTE, alloc_size); |
66 FXSYS_memcpy32(m_pTypeList, src.m_pTypeList, m_PathCount); | 66 FXSYS_memcpy32(m_pTypeList, src.m_pTypeList, m_PathCount); |
67 } else { | 67 } else { |
68 m_pPathList = NULL; | 68 m_pPathList = NULL; |
69 m_pTypeList = NULL; | 69 m_pTypeList = NULL; |
70 } | 70 } |
71 m_TextCount = src.m_TextCount; | 71 m_TextCount = src.m_TextCount; |
72 if (m_TextCount) { | 72 if (m_TextCount) { |
73 m_pTextList = FX_Alloc(CPDF_TextObject*, m_TextCount); | 73 m_pTextList = FX_Alloc(CPDF_TextObject*, m_TextCount); |
74 FXSYS_memset32(m_pTextList, 0, sizeof(CPDF_TextObject*) * m_TextCount); | |
75 for (int i = 0; i < m_TextCount; i ++) { | 74 for (int i = 0; i < m_TextCount; i ++) { |
76 if (src.m_pTextList[i]) { | 75 if (src.m_pTextList[i]) { |
77 m_pTextList[i] = FX_NEW CPDF_TextObject; | 76 m_pTextList[i] = FX_NEW CPDF_TextObject; |
78 m_pTextList[i]->Copy(src.m_pTextList[i]); | 77 m_pTextList[i]->Copy(src.m_pTextList[i]); |
79 } else { | 78 } else { |
80 m_pTextList[i] = NULL; | 79 m_pTextList[i] = NULL; |
81 } | 80 } |
82 } | 81 } |
83 } else { | 82 } else { |
84 m_pTextList = NULL; | 83 m_pTextList = NULL; |
85 } | 84 } |
86 } | 85 } |
87 void CPDF_ClipPathData::SetCount(int path_count, int text_count) | 86 void CPDF_ClipPathData::SetCount(int path_count, int text_count) |
88 { | 87 { |
89 ASSERT(m_TextCount == 0 && m_PathCount == 0); | 88 ASSERT(m_TextCount == 0 && m_PathCount == 0); |
90 if (path_count) { | 89 if (path_count) { |
91 m_PathCount = path_count; | 90 m_PathCount = path_count; |
92 int alloc_size = (path_count + 7) / 8 * 8; | 91 int alloc_size = (path_count + 7) / 8 * 8; |
93 FX_NEW_VECTOR(m_pPathList, CPDF_Path, alloc_size); | 92 FX_NEW_VECTOR(m_pPathList, CPDF_Path, alloc_size); |
94 m_pTypeList = FX_Alloc(FX_BYTE, alloc_size); | 93 m_pTypeList = FX_Alloc(FX_BYTE, alloc_size); |
95 } | 94 } |
96 if (text_count) { | 95 if (text_count) { |
97 m_TextCount = text_count; | 96 m_TextCount = text_count; |
98 m_pTextList = FX_Alloc(CPDF_TextObject*, text_count); | 97 m_pTextList = FX_Alloc(CPDF_TextObject*, text_count); |
99 FXSYS_memset32(m_pTextList, 0, sizeof(void*) * text_count); | |
100 } | 98 } |
101 } | 99 } |
102 CPDF_Rect CPDF_ClipPath::GetClipBox() const | 100 CPDF_Rect CPDF_ClipPath::GetClipBox() const |
103 { | 101 { |
104 CPDF_Rect rect; | 102 CPDF_Rect rect; |
105 FX_BOOL bStarted = FALSE; | 103 FX_BOOL bStarted = FALSE; |
106 int count = GetPathCount(); | 104 int count = GetPathCount(); |
107 if (count) { | 105 if (count) { |
108 rect = GetPath(0).GetBoundingBox(); | 106 rect = GetPath(0).GetBoundingBox(); |
109 for (int i = 1; i < count; i ++) { | 107 for (int i = 1; i < count; i ++) { |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 pDict = NULL; | 698 pDict = NULL; |
701 if (item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict || | 699 if (item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict || |
702 item.GetParamType() == CPDF_ContentMarkItem::DirectDict) { | 700 item.GetParamType() == CPDF_ContentMarkItem::DirectDict) { |
703 pDict = (CPDF_Dictionary*)item.GetParam(); | 701 pDict = (CPDF_Dictionary*)item.GetParam(); |
704 } | 702 } |
705 return TRUE; | 703 return TRUE; |
706 } | 704 } |
707 } | 705 } |
708 return FALSE; | 706 return FALSE; |
709 } | 707 } |
OLD | NEW |