Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp

Issue 493163003: Use number of components from ICC profile and alternateCS (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 CPDF_ColorSpace* _CSFromName(const CFX_ByteString& name); 101 CPDF_ColorSpace* _CSFromName(const CFX_ByteString& name);
102 CPDF_ColorSpace* CPDF_Document::LoadColorSpace(CPDF_Object* pCSObj, CPDF_Diction ary* pResources) 102 CPDF_ColorSpace* CPDF_Document::LoadColorSpace(CPDF_Object* pCSObj, CPDF_Diction ary* pResources)
103 { 103 {
104 return GetValidatePageData()->GetColorSpace(pCSObj, pResources); 104 return GetValidatePageData()->GetColorSpace(pCSObj, pResources);
105 } 105 }
106 CPDF_Pattern* CPDF_Document::LoadPattern(CPDF_Object* pPatternObj, FX_BOOL bShad ing, const CFX_AffineMatrix* matrix) 106 CPDF_Pattern* CPDF_Document::LoadPattern(CPDF_Object* pPatternObj, FX_BOOL bShad ing, const CFX_AffineMatrix* matrix)
107 { 107 {
108 return GetValidatePageData()->GetPattern(pPatternObj, bShading, matrix); 108 return GetValidatePageData()->GetPattern(pPatternObj, bShading, matrix);
109 } 109 }
110 CPDF_IccProfile* CPDF_Document::LoadIccProfile(CPDF_Stream* pStream, int nCompon ents) 110 CPDF_IccProfile* CPDF_Document::LoadIccProfile(CPDF_Stream* pStream)
111 { 111 {
112 return GetValidatePageData()->GetIccProfile(pStream, nComponents); 112 return GetValidatePageData()->GetIccProfile(pStream);
113 } 113 }
114 CPDF_Image* CPDF_Document::LoadImageF(CPDF_Object* pObj) 114 CPDF_Image* CPDF_Document::LoadImageF(CPDF_Object* pObj)
115 { 115 {
116 if (!pObj) { 116 if (!pObj) {
117 return NULL; 117 return NULL;
118 } 118 }
119 FXSYS_assert(pObj->GetObjNum()); 119 FXSYS_assert(pObj->GetObjNum());
120 return GetValidatePageData()->GetImage(pObj); 120 return GetValidatePageData()->GetImage(pObj);
121 } 121 }
122 void CPDF_Document::RemoveColorSpaceFromPageData(CPDF_Object* pCSObj) 122 void CPDF_Document::RemoveColorSpaceFromPageData(CPDF_Object* pCSObj)
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 m_ImageMap.SetAt(dwImageObjNum, imageData); 536 m_ImageMap.SetAt(dwImageObjNum, imageData);
537 return pImage; 537 return pImage;
538 } 538 }
539 void CPDF_DocPageData::ReleaseImage(CPDF_Object* pImageStream) 539 void CPDF_DocPageData::ReleaseImage(CPDF_Object* pImageStream)
540 { 540 {
541 if (!pImageStream) { 541 if (!pImageStream) {
542 return; 542 return;
543 } 543 }
544 PDF_DocPageData_Release<FX_DWORD, CPDF_Image*>(m_ImageMap, pImageStream->Get ObjNum(), NULL); 544 PDF_DocPageData_Release<FX_DWORD, CPDF_Image*>(m_ImageMap, pImageStream->Get ObjNum(), NULL);
545 } 545 }
546 CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(CPDF_Stream* pIccProfileStream, FX_INT32 nComponents) 546 CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(CPDF_Stream* pIccProfileStream)
547 { 547 {
548 if (!pIccProfileStream) { 548 if (!pIccProfileStream) {
549 return NULL; 549 return NULL;
550 } 550 }
551 CPDF_CountedObject<CPDF_IccProfile*>* ipData = NULL; 551 CPDF_CountedObject<CPDF_IccProfile*>* ipData = NULL;
552 if (m_IccProfileMap.Lookup(pIccProfileStream, ipData)) { 552 if (m_IccProfileMap.Lookup(pIccProfileStream, ipData)) {
553 ipData->m_nCount++; 553 ipData->m_nCount++;
554 return ipData->m_Obj; 554 return ipData->m_Obj;
555 } 555 }
556 CPDF_StreamAcc stream; 556 CPDF_StreamAcc stream;
557 stream.LoadAllData(pIccProfileStream, FALSE); 557 stream.LoadAllData(pIccProfileStream, FALSE);
558 FX_BYTE digest[20]; 558 FX_BYTE digest[20];
559 CPDF_Stream* pCopiedStream = NULL; 559 CPDF_Stream* pCopiedStream = NULL;
560 CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest); 560 CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest);
561 if (m_HashProfileMap.Lookup(CFX_ByteStringC(digest, 20), (void*&)pCopiedStre am)) { 561 if (m_HashProfileMap.Lookup(CFX_ByteStringC(digest, 20), (void*&)pCopiedStre am)) {
562 m_IccProfileMap.Lookup(pCopiedStream, ipData); 562 m_IccProfileMap.Lookup(pCopiedStream, ipData);
563 ipData->m_nCount++; 563 ipData->m_nCount++;
564 return ipData->m_Obj; 564 return ipData->m_Obj;
565 } 565 }
566 CPDF_IccProfile* pProfile = FX_NEW CPDF_IccProfile(stream.GetData(), stream. GetSize(), nComponents); 566 CPDF_IccProfile* pProfile = FX_NEW CPDF_IccProfile(stream.GetData(), stream. GetSize());
567 if (!pProfile) { 567 if (!pProfile) {
568 return NULL; 568 return NULL;
569 } 569 }
570 ipData = FX_NEW CPDF_CountedObject<CPDF_IccProfile*>; 570 ipData = FX_NEW CPDF_CountedObject<CPDF_IccProfile*>;
571 if (!ipData) { 571 if (!ipData) {
572 delete pProfile; 572 delete pProfile;
573 return NULL; 573 return NULL;
574 } 574 }
575 ipData->m_nCount = 2; 575 ipData->m_nCount = 2;
576 ipData->m_Obj = pProfile; 576 ipData->m_Obj = pProfile;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 m_FontFileMap.SetAt(pFontStream, ftData); 628 m_FontFileMap.SetAt(pFontStream, ftData);
629 return pFontFile; 629 return pFontFile;
630 } 630 }
631 void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOO L bForce) 631 void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOO L bForce)
632 { 632 {
633 if (!pFontStream) { 633 if (!pFontStream) {
634 return; 634 return;
635 } 635 }
636 PDF_DocPageData_Release<CPDF_Stream*, CPDF_StreamAcc*>(m_FontFileMap, pFontS tream, NULL, bForce); 636 PDF_DocPageData_Release<CPDF_Stream*, CPDF_StreamAcc*>(m_FontFileMap, pFontS tream, NULL, bForce);
637 } 637 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698