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/fdrm/fx_crypt.h" | 9 #include "core/include/fdrm/fx_crypt.h" |
10 #include "core/include/fpdfapi/fpdf_module.h" | 10 #include "core/include/fpdfapi/fpdf_module.h" |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace( | 310 CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace( |
311 CPDF_Object* pCSObj, | 311 CPDF_Object* pCSObj, |
312 const CPDF_Dictionary* pResources) { | 312 const CPDF_Dictionary* pResources) { |
313 if (!pCSObj) | 313 if (!pCSObj) |
314 return nullptr; | 314 return nullptr; |
315 | 315 |
316 if (pCSObj->IsName()) { | 316 if (pCSObj->IsName()) { |
317 CFX_ByteString name = pCSObj->GetConstString(); | 317 CFX_ByteString name = pCSObj->GetConstString(); |
318 CPDF_ColorSpace* pCS = _CSFromName(name); | 318 CPDF_ColorSpace* pCS = _CSFromName(name); |
319 if (!pCS && pResources) { | 319 if (!pCS && pResources) { |
320 CPDF_Dictionary* pList = pResources->GetDict("ColorSpace"); | 320 CPDF_Dictionary* pList = pResources->GetDictBy("ColorSpace"); |
321 if (pList) { | 321 if (pList) { |
322 pCSObj = pList->GetElementValue(name); | 322 pCSObj = pList->GetElementValue(name); |
323 return GetColorSpace(pCSObj, nullptr); | 323 return GetColorSpace(pCSObj, nullptr); |
324 } | 324 } |
325 } | 325 } |
326 if (!pCS || !pResources) | 326 if (!pCS || !pResources) |
327 return pCS; | 327 return pCS; |
328 | 328 |
329 CPDF_Dictionary* pColorSpaces = pResources->GetDict("ColorSpace"); | 329 CPDF_Dictionary* pColorSpaces = pResources->GetDictBy("ColorSpace"); |
330 if (!pColorSpaces) | 330 if (!pColorSpaces) |
331 return pCS; | 331 return pCS; |
332 | 332 |
333 CPDF_Object* pDefaultCS = nullptr; | 333 CPDF_Object* pDefaultCS = nullptr; |
334 switch (pCS->GetFamily()) { | 334 switch (pCS->GetFamily()) { |
335 case PDFCS_DEVICERGB: | 335 case PDFCS_DEVICERGB: |
336 pDefaultCS = pColorSpaces->GetElementValue("DefaultRGB"); | 336 pDefaultCS = pColorSpaces->GetElementValue("DefaultRGB"); |
337 break; | 337 break; |
338 case PDFCS_DEVICEGRAY: | 338 case PDFCS_DEVICEGRAY: |
339 pDefaultCS = pColorSpaces->GetElementValue("DefaultGray"); | 339 pDefaultCS = pColorSpaces->GetElementValue("DefaultGray"); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 return ptData->AddRef(); | 416 return ptData->AddRef(); |
417 } | 417 } |
418 } | 418 } |
419 CPDF_Pattern* pPattern = nullptr; | 419 CPDF_Pattern* pPattern = nullptr; |
420 if (bShading) { | 420 if (bShading) { |
421 pPattern = | 421 pPattern = |
422 new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, bShading, matrix); | 422 new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, bShading, matrix); |
423 } else { | 423 } else { |
424 CPDF_Dictionary* pDict = pPatternObj ? pPatternObj->GetDict() : nullptr; | 424 CPDF_Dictionary* pDict = pPatternObj ? pPatternObj->GetDict() : nullptr; |
425 if (pDict) { | 425 if (pDict) { |
426 int type = pDict->GetInteger("PatternType"); | 426 int type = pDict->GetIntegerBy("PatternType"); |
427 if (type == 1) { | 427 if (type == 1) { |
428 pPattern = new CPDF_TilingPattern(m_pPDFDoc, pPatternObj, matrix); | 428 pPattern = new CPDF_TilingPattern(m_pPDFDoc, pPatternObj, matrix); |
429 } else if (type == 2) { | 429 } else if (type == 2) { |
430 pPattern = | 430 pPattern = |
431 new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, FALSE, matrix); | 431 new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, FALSE, matrix); |
432 } | 432 } |
433 } | 433 } |
434 } | 434 } |
435 if (!pPattern) | 435 if (!pPattern) |
436 return nullptr; | 436 return nullptr; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 546 |
547 CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc( | 547 CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc( |
548 CPDF_Stream* pFontStream) { | 548 CPDF_Stream* pFontStream) { |
549 ASSERT(pFontStream); | 549 ASSERT(pFontStream); |
550 | 550 |
551 auto it = m_FontFileMap.find(pFontStream); | 551 auto it = m_FontFileMap.find(pFontStream); |
552 if (it != m_FontFileMap.end()) | 552 if (it != m_FontFileMap.end()) |
553 return it->second->AddRef(); | 553 return it->second->AddRef(); |
554 | 554 |
555 CPDF_Dictionary* pFontDict = pFontStream->GetDict(); | 555 CPDF_Dictionary* pFontDict = pFontStream->GetDict(); |
556 int32_t org_size = pFontDict->GetInteger("Length1") + | 556 int32_t org_size = pFontDict->GetIntegerBy("Length1") + |
557 pFontDict->GetInteger("Length2") + | 557 pFontDict->GetIntegerBy("Length2") + |
558 pFontDict->GetInteger("Length3"); | 558 pFontDict->GetIntegerBy("Length3"); |
559 if (org_size < 0) | 559 if (org_size < 0) |
560 org_size = 0; | 560 org_size = 0; |
561 | 561 |
562 CPDF_StreamAcc* pFontFile = new CPDF_StreamAcc; | 562 CPDF_StreamAcc* pFontFile = new CPDF_StreamAcc; |
563 pFontFile->LoadAllData(pFontStream, FALSE, org_size); | 563 pFontFile->LoadAllData(pFontStream, FALSE, org_size); |
564 | 564 |
565 CPDF_CountedStreamAcc* ftData = new CPDF_CountedStreamAcc(pFontFile); | 565 CPDF_CountedStreamAcc* ftData = new CPDF_CountedStreamAcc(pFontFile); |
566 m_FontFileMap[pFontStream] = ftData; | 566 m_FontFileMap[pFontStream] = ftData; |
567 return ftData->AddRef(); | 567 return ftData->AddRef(); |
568 } | 568 } |
(...skipping 29 matching lines...) Expand all Loading... |
598 } | 598 } |
599 | 599 |
600 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( | 600 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( |
601 CPDF_Object* pPatternObj) const { | 601 CPDF_Object* pPatternObj) const { |
602 if (!pPatternObj) | 602 if (!pPatternObj) |
603 return nullptr; | 603 return nullptr; |
604 | 604 |
605 auto it = m_PatternMap.find(pPatternObj); | 605 auto it = m_PatternMap.find(pPatternObj); |
606 return it != m_PatternMap.end() ? it->second : nullptr; | 606 return it != m_PatternMap.end() ? it->second : nullptr; |
607 } | 607 } |
OLD | NEW |