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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 index -= PARAM_BUF_SIZE; | 107 index -= PARAM_BUF_SIZE; |
108 } | 108 } |
109 m_ParamCount++; | 109 m_ParamCount++; |
110 return index; | 110 return index; |
111 } | 111 } |
112 void CPDF_StreamContentParser::AddNameParam(const FX_CHAR* name, int len) { | 112 void CPDF_StreamContentParser::AddNameParam(const FX_CHAR* name, int len) { |
113 int index = GetNextParamPos(); | 113 int index = GetNextParamPos(); |
114 if (len > 32) { | 114 if (len > 32) { |
115 m_ParamBuf1[index].m_Type = 0; | 115 m_ParamBuf1[index].m_Type = 0; |
116 m_ParamBuf1[index].m_pObject = | 116 m_ParamBuf1[index].m_pObject = |
117 CPDF_Name::Create(PDF_NameDecode(CFX_ByteStringC(name, len))); | 117 new CPDF_Name(PDF_NameDecode(CFX_ByteStringC(name, len))); |
118 } else { | 118 } else { |
119 m_ParamBuf1[index].m_Type = PDFOBJ_NAME; | 119 m_ParamBuf1[index].m_Type = PDFOBJ_NAME; |
120 if (!FXSYS_memchr(name, '#', len)) { | 120 if (!FXSYS_memchr(name, '#', len)) { |
121 FXSYS_memcpy(m_ParamBuf1[index].m_Name.m_Buffer, name, len); | 121 FXSYS_memcpy(m_ParamBuf1[index].m_Name.m_Buffer, name, len); |
122 m_ParamBuf1[index].m_Name.m_Len = len; | 122 m_ParamBuf1[index].m_Name.m_Len = len; |
123 } else { | 123 } else { |
124 CFX_ByteString str = PDF_NameDecode(CFX_ByteStringC(name, len)); | 124 CFX_ByteString str = PDF_NameDecode(CFX_ByteStringC(name, len)); |
125 FXSYS_memcpy(m_ParamBuf1[index].m_Name.m_Buffer, str.c_str(), | 125 FXSYS_memcpy(m_ParamBuf1[index].m_Name.m_Buffer, str.c_str(), |
126 str.GetLength()); | 126 str.GetLength()); |
127 m_ParamBuf1[index].m_Name.m_Len = str.GetLength(); | 127 m_ParamBuf1[index].m_Name.m_Len = str.GetLength(); |
(...skipping 30 matching lines...) Expand all Loading... |
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 ? CPDF_Number::Create(param.m_Number.m_Integer) | 168 ? new CPDF_Number(param.m_Number.m_Integer) |
169 : CPDF_Number::Create(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) { |
176 CPDF_Name* pName = CPDF_Name::Create( | 176 CPDF_Name* pName = new CPDF_Name( |
177 CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len)); | 177 CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len)); |
178 param.m_Type = 0; | 178 param.m_Type = 0; |
179 param.m_pObject = pName; | 179 param.m_pObject = pName; |
180 return pName; | 180 return pName; |
181 } | 181 } |
182 if (param.m_Type == 0) { | 182 if (param.m_Type == 0) { |
183 return param.m_pObject; | 183 return param.m_pObject; |
184 } | 184 } |
185 ASSERT(FALSE); | 185 ASSERT(FALSE); |
186 return NULL; | 186 return NULL; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 case PDFOBJ_ARRAY: { | 517 case PDFOBJ_ARRAY: { |
518 CPDF_Array* pArray = pObj->AsArray(); | 518 CPDF_Array* pArray = pObj->AsArray(); |
519 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { | 519 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { |
520 CPDF_Object* pElement = pArray->GetElement(i); | 520 CPDF_Object* pElement = pArray->GetElement(i); |
521 if (pElement->IsName()) { | 521 if (pElement->IsName()) { |
522 CFX_ByteString name = pElement->GetString(); | 522 CFX_ByteString name = pElement->GetString(); |
523 CFX_ByteStringC fullname = _PDF_FindFullName( | 523 CFX_ByteStringC fullname = _PDF_FindFullName( |
524 _PDF_InlineValueAbbr, | 524 _PDF_InlineValueAbbr, |
525 sizeof _PDF_InlineValueAbbr / sizeof(_FX_BSTR), name); | 525 sizeof _PDF_InlineValueAbbr / sizeof(_FX_BSTR), name); |
526 if (!fullname.IsEmpty()) { | 526 if (!fullname.IsEmpty()) { |
527 pArray->SetAt(i, CPDF_Name::Create(fullname)); | 527 pArray->SetAt(i, new CPDF_Name(fullname)); |
528 } | 528 } |
529 } else { | 529 } else { |
530 _PDF_ReplaceAbbr(pElement); | 530 _PDF_ReplaceAbbr(pElement); |
531 } | 531 } |
532 } | 532 } |
533 break; | 533 break; |
534 } | 534 } |
535 } | 535 } |
536 } | 536 } |
537 static CFX_ByteStringC _PDF_FindAbbrName(const _FX_BSTR* table, | 537 static CFX_ByteStringC _PDF_FindAbbrName(const _FX_BSTR* table, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 case PDFOBJ_ARRAY: { | 580 case PDFOBJ_ARRAY: { |
581 CPDF_Array* pArray = pObj->AsArray(); | 581 CPDF_Array* pArray = pObj->AsArray(); |
582 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { | 582 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { |
583 CPDF_Object* pElement = pArray->GetElement(i); | 583 CPDF_Object* pElement = pArray->GetElement(i); |
584 if (pElement->IsName()) { | 584 if (pElement->IsName()) { |
585 CFX_ByteString name = pElement->GetString(); | 585 CFX_ByteString name = pElement->GetString(); |
586 CFX_ByteStringC abbrName = _PDF_FindAbbrName( | 586 CFX_ByteStringC abbrName = _PDF_FindAbbrName( |
587 _PDF_InlineValueAbbr, | 587 _PDF_InlineValueAbbr, |
588 sizeof _PDF_InlineValueAbbr / sizeof(_FX_BSTR), name); | 588 sizeof _PDF_InlineValueAbbr / sizeof(_FX_BSTR), name); |
589 if (!abbrName.IsEmpty()) { | 589 if (!abbrName.IsEmpty()) { |
590 pArray->SetAt(i, CPDF_Name::Create(abbrName)); | 590 pArray->SetAt(i, new CPDF_Name(abbrName)); |
591 } | 591 } |
592 } else { | 592 } else { |
593 _PDF_ReplaceFull(pElement); | 593 _PDF_ReplaceFull(pElement); |
594 } | 594 } |
595 } | 595 } |
596 break; | 596 break; |
597 } | 597 } |
598 } | 598 } |
599 } | 599 } |
600 void CPDF_StreamContentParser::Handle_BeginText() { | 600 void CPDF_StreamContentParser::Handle_BeginText() { |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 m_pObjectList->m_ObjectList.AddTail(pPathObj); | 1518 m_pObjectList->m_ObjectList.AddTail(pPathObj); |
1519 } | 1519 } |
1520 if (PathClipType) { | 1520 if (PathClipType) { |
1521 if (!matrix.IsIdentity()) { | 1521 if (!matrix.IsIdentity()) { |
1522 Path.Transform(&matrix); | 1522 Path.Transform(&matrix); |
1523 matrix.SetIdentity(); | 1523 matrix.SetIdentity(); |
1524 } | 1524 } |
1525 m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE); | 1525 m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE); |
1526 } | 1526 } |
1527 } | 1527 } |
OLD | NEW |