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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 if (!pIccProfileStream) { | 565 if (!pIccProfileStream) { |
566 return NULL; | 566 return NULL; |
567 } | 567 } |
568 CPDF_CountedObject<CPDF_IccProfile*>* ipData = NULL; | 568 CPDF_CountedObject<CPDF_IccProfile*>* ipData = NULL; |
569 if (m_IccProfileMap.Lookup(pIccProfileStream, ipData)) { | 569 if (m_IccProfileMap.Lookup(pIccProfileStream, ipData)) { |
570 ipData->m_nCount++; | 570 ipData->m_nCount++; |
571 return ipData->m_Obj; | 571 return ipData->m_Obj; |
572 } | 572 } |
573 CPDF_StreamAcc stream; | 573 CPDF_StreamAcc stream; |
574 stream.LoadAllData(pIccProfileStream, FALSE); | 574 stream.LoadAllData(pIccProfileStream, FALSE); |
575 FX_BYTE digest[20]; | 575 uint8_t digest[20]; |
576 CPDF_Stream* pCopiedStream = NULL; | 576 CPDF_Stream* pCopiedStream = NULL; |
577 CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest); | 577 CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest); |
578 if (m_HashProfileMap.Lookup(CFX_ByteStringC(digest, 20), (void*&)pCopiedStre
am)) { | 578 if (m_HashProfileMap.Lookup(CFX_ByteStringC(digest, 20), (void*&)pCopiedStre
am)) { |
579 m_IccProfileMap.Lookup(pCopiedStream, ipData); | 579 m_IccProfileMap.Lookup(pCopiedStream, ipData); |
580 ipData->m_nCount++; | 580 ipData->m_nCount++; |
581 return ipData->m_Obj; | 581 return ipData->m_Obj; |
582 } | 582 } |
583 CPDF_IccProfile* pProfile = new CPDF_IccProfile(stream.GetData(), stream.Get
Size()); | 583 CPDF_IccProfile* pProfile = new CPDF_IccProfile(stream.GetData(), stream.Get
Size()); |
584 ipData = new CPDF_CountedObject<CPDF_IccProfile*>; | 584 ipData = new CPDF_CountedObject<CPDF_IccProfile*>; |
585 ipData->m_nCount = 2; | 585 ipData->m_nCount = 2; |
(...skipping 28 matching lines...) Expand all Loading... |
614 return NULL; | 614 return NULL; |
615 } | 615 } |
616 CPDF_CountedObject<CPDF_StreamAcc*>* ftData; | 616 CPDF_CountedObject<CPDF_StreamAcc*>* ftData; |
617 if (m_FontFileMap.Lookup(pFontStream, ftData)) { | 617 if (m_FontFileMap.Lookup(pFontStream, ftData)) { |
618 ftData->m_nCount ++; | 618 ftData->m_nCount ++; |
619 return ftData->m_Obj; | 619 return ftData->m_Obj; |
620 } | 620 } |
621 ftData = new CPDF_CountedObject<CPDF_StreamAcc*>; | 621 ftData = new CPDF_CountedObject<CPDF_StreamAcc*>; |
622 CPDF_StreamAcc* pFontFile = new CPDF_StreamAcc; | 622 CPDF_StreamAcc* pFontFile = new CPDF_StreamAcc; |
623 CPDF_Dictionary* pFontDict = pFontStream->GetDict(); | 623 CPDF_Dictionary* pFontDict = pFontStream->GetDict(); |
624 FX_INT32 org_size = pFontDict->GetInteger(FX_BSTRC("Length1")) + pFontDict->
GetInteger(FX_BSTRC("Length2")) + pFontDict->GetInteger(FX_BSTRC("Length3")); | 624 int32_t org_size = pFontDict->GetInteger(FX_BSTRC("Length1")) + pFontDict->G
etInteger(FX_BSTRC("Length2")) + pFontDict->GetInteger(FX_BSTRC("Length3")); |
625 if (org_size < 0) { | 625 if (org_size < 0) { |
626 org_size = 0; | 626 org_size = 0; |
627 } | 627 } |
628 pFontFile->LoadAllData(pFontStream, FALSE, org_size); | 628 pFontFile->LoadAllData(pFontStream, FALSE, org_size); |
629 ftData->m_nCount = 2; | 629 ftData->m_nCount = 2; |
630 ftData->m_Obj = pFontFile; | 630 ftData->m_Obj = pFontFile; |
631 m_FontFileMap.SetAt(pFontStream, ftData); | 631 m_FontFileMap.SetAt(pFontStream, ftData); |
632 return pFontFile; | 632 return pFontFile; |
633 } | 633 } |
634 void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOO
L bForce) | 634 void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOO
L bForce) |
(...skipping 16 matching lines...) Expand all Loading... |
651 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr(CPDF_Object* pPatternObj)
const | 651 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr(CPDF_Object* pPatternObj)
const |
652 { | 652 { |
653 if (!pPatternObj) return NULL; | 653 if (!pPatternObj) return NULL; |
654 CPDF_CountedObject<CPDF_Pattern*>* ptData; | 654 CPDF_CountedObject<CPDF_Pattern*>* ptData; |
655 if (m_PatternMap.Lookup(pPatternObj, ptData)) | 655 if (m_PatternMap.Lookup(pPatternObj, ptData)) |
656 { | 656 { |
657 return ptData; | 657 return ptData; |
658 } | 658 } |
659 return NULL; | 659 return NULL; |
660 } | 660 } |
OLD | NEW |