| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 pData->m_pPathList[pData->m_PathCount - 1].SetNull(); | 187 pData->m_pPathList[pData->m_PathCount - 1].SetNull(); |
| 188 FXSYS_memmove32(pData->m_pTypeList + index, pData->m_pTypeList + index + 1,
pData->m_PathCount - index - 1); | 188 FXSYS_memmove32(pData->m_pTypeList + index, pData->m_pTypeList + index + 1,
pData->m_PathCount - index - 1); |
| 189 pData->m_PathCount --; | 189 pData->m_PathCount --; |
| 190 } | 190 } |
| 191 #define FPDF_CLIPPATH_MAX_TEXTS 1024 | 191 #define FPDF_CLIPPATH_MAX_TEXTS 1024 |
| 192 void CPDF_ClipPath::AppendTexts(CPDF_TextObject** pTexts, int count) | 192 void CPDF_ClipPath::AppendTexts(CPDF_TextObject** pTexts, int count) |
| 193 { | 193 { |
| 194 CPDF_ClipPathData* pData = GetModify(); | 194 CPDF_ClipPathData* pData = GetModify(); |
| 195 if (pData->m_TextCount + count > FPDF_CLIPPATH_MAX_TEXTS) { | 195 if (pData->m_TextCount + count > FPDF_CLIPPATH_MAX_TEXTS) { |
| 196 for (int i = 0; i < count; i ++) { | 196 for (int i = 0; i < count; i ++) { |
| 197 pTexts[i]->Release(); | 197 if (pTexts[i]) |
| 198 pTexts[i]->Release(); |
| 198 } | 199 } |
| 199 return; | 200 return; |
| 200 } | 201 } |
| 201 CPDF_TextObject** pNewList = FX_Alloc(CPDF_TextObject*, pData->m_TextCount +
count + 1); | 202 CPDF_TextObject** pNewList = FX_Alloc(CPDF_TextObject*, pData->m_TextCount +
count + 1); |
| 202 if (pData->m_pTextList) { | 203 if (pData->m_pTextList) { |
| 203 FXSYS_memcpy32(pNewList, pData->m_pTextList, pData->m_TextCount * sizeof
(CPDF_TextObject*)); | 204 FXSYS_memcpy32(pNewList, pData->m_pTextList, pData->m_TextCount * sizeof
(CPDF_TextObject*)); |
| 204 FX_Free(pData->m_pTextList); | 205 FX_Free(pData->m_pTextList); |
| 205 } | 206 } |
| 206 pData->m_pTextList = pNewList; | 207 pData->m_pTextList = pNewList; |
| 207 for (int i = 0; i < count; i ++) { | 208 for (int i = 0; i < count; i ++) { |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) { | 475 for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) { |
| 475 pData->m_DashArray[i] = FXSYS_Mul(pArray->GetNumber(i), scale); | 476 pData->m_DashArray[i] = FXSYS_Mul(pArray->GetNumber(i), scale); |
| 476 } | 477 } |
| 477 } | 478 } |
| 478 void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, CPDF_StreamContentParser
* pParser) | 479 void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, CPDF_StreamContentParser
* pParser) |
| 479 { | 480 { |
| 480 CPDF_GeneralStateData* pGeneralState = m_GeneralState.GetModify(); | 481 CPDF_GeneralStateData* pGeneralState = m_GeneralState.GetModify(); |
| 481 FX_POSITION pos = pGS->GetStartPos(); | 482 FX_POSITION pos = pGS->GetStartPos(); |
| 482 while (pos) { | 483 while (pos) { |
| 483 CFX_ByteString key_str; | 484 CFX_ByteString key_str; |
| 484 CPDF_Object* pObject = pGS->GetNextElement(pos, key_str)->GetDirect(); | 485 CPDF_Object* pElement = pGS->GetNextElement(pos, key_str); |
| 486 CPDF_Object* pObject = pElement ? pElement->GetDirect() : NULL; |
| 485 if (pObject == NULL) { | 487 if (pObject == NULL) { |
| 486 continue; | 488 continue; |
| 487 } | 489 } |
| 488 FX_DWORD key = key_str.GetID(); | 490 FX_DWORD key = key_str.GetID(); |
| 489 switch (key) { | 491 switch (key) { |
| 490 case FXBSTR_ID('L', 'W', 0, 0): | 492 case FXBSTR_ID('L', 'W', 0, 0): |
| 491 m_GraphState.GetModify()->m_LineWidth = pObject->GetNumber(); | 493 m_GraphState.GetModify()->m_LineWidth = pObject->GetNumber(); |
| 492 break; | 494 break; |
| 493 case FXBSTR_ID('L', 'C', 0, 0): | 495 case FXBSTR_ID('L', 'C', 0, 0): |
| 494 m_GraphState.GetModify()->m_LineCap = (CFX_GraphStateData::LineC
ap)pObject->GetInteger(); | 496 m_GraphState.GetModify()->m_LineCap = (CFX_GraphStateData::LineC
ap)pObject->GetInteger(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 m_MarkName = src.m_MarkName; | 620 m_MarkName = src.m_MarkName; |
| 619 m_ParamType = src.m_ParamType; | 621 m_ParamType = src.m_ParamType; |
| 620 if (m_ParamType == DirectDict) { | 622 if (m_ParamType == DirectDict) { |
| 621 m_pParam = ((CPDF_Dictionary*)src.m_pParam)->Clone(); | 623 m_pParam = ((CPDF_Dictionary*)src.m_pParam)->Clone(); |
| 622 } else { | 624 } else { |
| 623 m_pParam = src.m_pParam; | 625 m_pParam = src.m_pParam; |
| 624 } | 626 } |
| 625 } | 627 } |
| 626 CPDF_ContentMarkItem::~CPDF_ContentMarkItem() | 628 CPDF_ContentMarkItem::~CPDF_ContentMarkItem() |
| 627 { | 629 { |
| 628 if (m_ParamType == DirectDict) { | 630 if (m_ParamType == DirectDict && m_pParam) { |
| 629 ((CPDF_Dictionary*)m_pParam)->Release(); | 631 ((CPDF_Dictionary*)m_pParam)->Release(); |
| 630 } | 632 } |
| 631 } | 633 } |
| 632 FX_BOOL CPDF_ContentMarkItem::HasMCID() const | 634 FX_BOOL CPDF_ContentMarkItem::HasMCID() const |
| 633 { | 635 { |
| 634 if (m_pParam && (m_ParamType == DirectDict || m_ParamType == PropertiesDict)
) { | 636 if (m_pParam && (m_ParamType == DirectDict || m_ParamType == PropertiesDict)
) { |
| 635 return ((CPDF_Dictionary *)m_pParam)->KeyExist(FX_BSTRC("MCID")); | 637 return ((CPDF_Dictionary *)m_pParam)->KeyExist(FX_BSTRC("MCID")); |
| 636 } | 638 } |
| 637 return FALSE; | 639 return FALSE; |
| 638 } | 640 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 pDict = NULL; | 700 pDict = NULL; |
| 699 if (item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict || | 701 if (item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict || |
| 700 item.GetParamType() == CPDF_ContentMarkItem::DirectDict) { | 702 item.GetParamType() == CPDF_ContentMarkItem::DirectDict) { |
| 701 pDict = (CPDF_Dictionary*)item.GetParam(); | 703 pDict = (CPDF_Dictionary*)item.GetParam(); |
| 702 } | 704 } |
| 703 return TRUE; | 705 return TRUE; |
| 704 } | 706 } |
| 705 } | 707 } |
| 706 return FALSE; | 708 return FALSE; |
| 707 } | 709 } |
| OLD | NEW |