| 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 "core/fpdfapi/fpdf_page/pageint.h" | 7 #include "core/fpdfapi/fpdf_page/pageint.h" | 
| 8 | 8 | 
| 9 #include "core/fdrm/crypto/include/fx_crypt.h" | 9 #include "core/fdrm/crypto/include/fx_crypt.h" | 
| 10 #include "core/fpdfapi/fpdf_font/cpdf_type1font.h" | 10 #include "core/fpdfapi/fpdf_font/cpdf_type1font.h" | 
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 324     const CPDF_Dictionary* pResources) { | 324     const CPDF_Dictionary* pResources) { | 
| 325   if (!pCSObj) | 325   if (!pCSObj) | 
| 326     return nullptr; | 326     return nullptr; | 
| 327 | 327 | 
| 328   if (pCSObj->IsName()) { | 328   if (pCSObj->IsName()) { | 
| 329     CFX_ByteString name = pCSObj->GetConstString(); | 329     CFX_ByteString name = pCSObj->GetConstString(); | 
| 330     CPDF_ColorSpace* pCS = CPDF_ColorSpace::ColorspaceFromName(name); | 330     CPDF_ColorSpace* pCS = CPDF_ColorSpace::ColorspaceFromName(name); | 
| 331     if (!pCS && pResources) { | 331     if (!pCS && pResources) { | 
| 332       CPDF_Dictionary* pList = pResources->GetDictBy("ColorSpace"); | 332       CPDF_Dictionary* pList = pResources->GetDictBy("ColorSpace"); | 
| 333       if (pList) { | 333       if (pList) { | 
| 334         pCSObj = pList->GetElementValue(name); | 334         pCSObj = pList->GetDirectObjectBy(name); | 
| 335         return GetColorSpace(pCSObj, nullptr); | 335         return GetColorSpace(pCSObj, nullptr); | 
| 336       } | 336       } | 
| 337     } | 337     } | 
| 338     if (!pCS || !pResources) | 338     if (!pCS || !pResources) | 
| 339       return pCS; | 339       return pCS; | 
| 340 | 340 | 
| 341     CPDF_Dictionary* pColorSpaces = pResources->GetDictBy("ColorSpace"); | 341     CPDF_Dictionary* pColorSpaces = pResources->GetDictBy("ColorSpace"); | 
| 342     if (!pColorSpaces) | 342     if (!pColorSpaces) | 
| 343       return pCS; | 343       return pCS; | 
| 344 | 344 | 
| 345     CPDF_Object* pDefaultCS = nullptr; | 345     CPDF_Object* pDefaultCS = nullptr; | 
| 346     switch (pCS->GetFamily()) { | 346     switch (pCS->GetFamily()) { | 
| 347       case PDFCS_DEVICERGB: | 347       case PDFCS_DEVICERGB: | 
| 348         pDefaultCS = pColorSpaces->GetElementValue("DefaultRGB"); | 348         pDefaultCS = pColorSpaces->GetDirectObjectBy("DefaultRGB"); | 
| 349         break; | 349         break; | 
| 350       case PDFCS_DEVICEGRAY: | 350       case PDFCS_DEVICEGRAY: | 
| 351         pDefaultCS = pColorSpaces->GetElementValue("DefaultGray"); | 351         pDefaultCS = pColorSpaces->GetDirectObjectBy("DefaultGray"); | 
| 352         break; | 352         break; | 
| 353       case PDFCS_DEVICECMYK: | 353       case PDFCS_DEVICECMYK: | 
| 354         pDefaultCS = pColorSpaces->GetElementValue("DefaultCMYK"); | 354         pDefaultCS = pColorSpaces->GetDirectObjectBy("DefaultCMYK"); | 
| 355         break; | 355         break; | 
| 356     } | 356     } | 
| 357     return pDefaultCS ? GetColorSpace(pDefaultCS, nullptr) : pCS; | 357     return pDefaultCS ? GetColorSpace(pDefaultCS, nullptr) : pCS; | 
| 358   } | 358   } | 
| 359 | 359 | 
| 360   CPDF_Array* pArray = pCSObj->AsArray(); | 360   CPDF_Array* pArray = pCSObj->AsArray(); | 
| 361   if (!pArray || pArray->GetCount() == 0) | 361   if (!pArray || pArray->GetCount() == 0) | 
| 362     return nullptr; | 362     return nullptr; | 
| 363   if (pArray->GetCount() == 1) | 363   if (pArray->GetCount() == 1) | 
| 364     return GetColorSpace(pArray->GetElementValue(0), pResources); | 364     return GetColorSpace(pArray->GetDirectObjectAt(0), pResources); | 
| 365 | 365 | 
| 366   CPDF_CountedColorSpace* csData = nullptr; | 366   CPDF_CountedColorSpace* csData = nullptr; | 
| 367   auto it = m_ColorSpaceMap.find(pCSObj); | 367   auto it = m_ColorSpaceMap.find(pCSObj); | 
| 368   if (it != m_ColorSpaceMap.end()) { | 368   if (it != m_ColorSpaceMap.end()) { | 
| 369     csData = it->second; | 369     csData = it->second; | 
| 370     if (csData->get()) { | 370     if (csData->get()) { | 
| 371       return csData->AddRef(); | 371       return csData->AddRef(); | 
| 372     } | 372     } | 
| 373   } | 373   } | 
| 374 | 374 | 
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 610 } | 610 } | 
| 611 | 611 | 
| 612 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( | 612 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( | 
| 613     CPDF_Object* pPatternObj) const { | 613     CPDF_Object* pPatternObj) const { | 
| 614   if (!pPatternObj) | 614   if (!pPatternObj) | 
| 615     return nullptr; | 615     return nullptr; | 
| 616 | 616 | 
| 617   auto it = m_PatternMap.find(pPatternObj); | 617   auto it = m_PatternMap.find(pPatternObj); | 
| 618   return it != m_PatternMap.end() ? it->second : nullptr; | 618   return it != m_PatternMap.end() ? it->second : nullptr; | 
| 619 } | 619 } | 
| OLD | NEW | 
|---|