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_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../../../include/fdrm/fx_crypt.h" | 9 #include "../../../include/fdrm/fx_crypt.h" |
10 #include "../fpdf_font/font_int.h" | 10 #include "../fpdf_font/font_int.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 case PDFCS_DEVICEGRAY: | 336 case PDFCS_DEVICEGRAY: |
337 pDefaultCS = pColorSpaces->GetElementValue(FX_BSTRC("DefaultGray")); | 337 pDefaultCS = pColorSpaces->GetElementValue(FX_BSTRC("DefaultGray")); |
338 break; | 338 break; |
339 case PDFCS_DEVICECMYK: | 339 case PDFCS_DEVICECMYK: |
340 pDefaultCS = pColorSpaces->GetElementValue(FX_BSTRC("DefaultCMYK")); | 340 pDefaultCS = pColorSpaces->GetElementValue(FX_BSTRC("DefaultCMYK")); |
341 break; | 341 break; |
342 } | 342 } |
343 return pDefaultCS ? GetColorSpace(pDefaultCS, nullptr) : pCS; | 343 return pDefaultCS ? GetColorSpace(pDefaultCS, nullptr) : pCS; |
344 } | 344 } |
345 | 345 |
346 if (pCSObj->GetType() != PDFOBJ_ARRAY) | 346 CPDF_Array* pArray = pCSObj->AsArray(); |
347 return nullptr; | 347 if (!pArray || pArray->GetCount() == 0) |
348 CPDF_Array* pArray = (CPDF_Array*)pCSObj; | |
349 if (pArray->GetCount() == 0) | |
350 return nullptr; | 348 return nullptr; |
351 if (pArray->GetCount() == 1) | 349 if (pArray->GetCount() == 1) |
352 return GetColorSpace(pArray->GetElementValue(0), pResources); | 350 return GetColorSpace(pArray->GetElementValue(0), pResources); |
353 | 351 |
354 CPDF_CountedColorSpace* csData = nullptr; | 352 CPDF_CountedColorSpace* csData = nullptr; |
355 auto it = m_ColorSpaceMap.find(pCSObj); | 353 auto it = m_ColorSpaceMap.find(pCSObj); |
356 if (it != m_ColorSpaceMap.end()) { | 354 if (it != m_ColorSpaceMap.end()) { |
357 csData = it->second; | 355 csData = it->second; |
358 if (csData->get()) { | 356 if (csData->get()) { |
359 return csData->AddRef(); | 357 return csData->AddRef(); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 } | 596 } |
599 | 597 |
600 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( | 598 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( |
601 CPDF_Object* pPatternObj) const { | 599 CPDF_Object* pPatternObj) const { |
602 if (!pPatternObj) | 600 if (!pPatternObj) |
603 return nullptr; | 601 return nullptr; |
604 | 602 |
605 auto it = m_PatternMap.find(pPatternObj); | 603 auto it = m_PatternMap.find(pPatternObj); |
606 return it != m_PatternMap.end() ? it->second : nullptr; | 604 return it != m_PatternMap.end() ? it->second : nullptr; |
607 } | 605 } |
OLD | NEW |