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

Side by Side Diff: core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp

Issue 885223004: Fix some typos in fpdf_render_loadimage.cpp. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 #include "../../../include/fxcodec/fx_codec.h" 8 #include "../../../include/fxcodec/fx_codec.h"
9 #include "../../../include/fpdfapi/fpdf_module.h" 9 #include "../../../include/fpdfapi/fpdf_module.h"
10 #include "../../../include/fpdfapi/fpdf_render.h" 10 #include "../../../include/fpdfapi/fpdf_render.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 delete m_pCachedBitmap; 150 delete m_pCachedBitmap;
151 delete m_pDecoder; 151 delete m_pDecoder;
152 if (m_pCompData) { 152 if (m_pCompData) {
153 FX_Free(m_pCompData); 153 FX_Free(m_pCompData);
154 } 154 }
155 CPDF_ColorSpace* pCS = m_pColorSpace; 155 CPDF_ColorSpace* pCS = m_pColorSpace;
156 if (pCS && m_pDocument) { 156 if (pCS && m_pDocument) {
157 m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray()); 157 m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
158 } 158 }
159 if (m_pJbig2Context) { 159 if (m_pJbig2Context) {
160 ICodec_Jbig2Module* pJbig2Moudle = CPDF_ModuleMgr::Get()->GetJbig2Module (); 160 ICodec_Jbig2Module* pJbig2Module = CPDF_ModuleMgr::Get()->GetJbig2Module ();
161 pJbig2Moudle->DestroyJbig2Context(m_pJbig2Context); 161 pJbig2Module->DestroyJbig2Context(m_pJbig2Context);
162 } 162 }
163 delete m_pGlobalStream; 163 delete m_pGlobalStream;
164 } 164 }
165 CFX_DIBitmap* CPDF_DIBSource::GetBitmap() const 165 CFX_DIBitmap* CPDF_DIBSource::GetBitmap() const
166 { 166 {
167 if (m_pCachedBitmap) { 167 if (m_pCachedBitmap) {
168 return m_pCachedBitmap; 168 return m_pCachedBitmap;
169 } 169 }
170 return Clone(); 170 return Clone();
171 } 171 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 return ret; 357 return ret;
358 } 358 }
359 int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) 359 int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause)
360 { 360 {
361 FXCODEC_STATUS ret; 361 FXCODEC_STATUS ret;
362 if (m_Status == 1) { 362 if (m_Status == 1) {
363 const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder(); 363 const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder();
364 if (decoder == FX_BSTRC("JPXDecode")) { 364 if (decoder == FX_BSTRC("JPXDecode")) {
365 return 0; 365 return 0;
366 } 366 }
367 ICodec_Jbig2Module* pJbig2Moudle = CPDF_ModuleMgr::Get()->GetJbig2Module (); 367 ICodec_Jbig2Module* pJbig2Module = CPDF_ModuleMgr::Get()->GetJbig2Module ();
368 if (m_pJbig2Context == NULL) { 368 if (m_pJbig2Context == NULL) {
369 m_pJbig2Context = pJbig2Moudle->CreateJbig2Context(); 369 m_pJbig2Context = pJbig2Module->CreateJbig2Context();
370 if (m_pStreamAcc->GetImageParam()) { 370 if (m_pStreamAcc->GetImageParam()) {
371 CPDF_Stream* pGlobals = m_pStreamAcc->GetImageParam()->GetStream (FX_BSTRC("JBIG2Globals")); 371 CPDF_Stream* pGlobals = m_pStreamAcc->GetImageParam()->GetStream (FX_BSTRC("JBIG2Globals"));
372 if (pGlobals) { 372 if (pGlobals) {
373 m_pGlobalStream = FX_NEW CPDF_StreamAcc; 373 m_pGlobalStream = FX_NEW CPDF_StreamAcc;
374 m_pGlobalStream->LoadAllData(pGlobals, FALSE); 374 m_pGlobalStream->LoadAllData(pGlobals, FALSE);
375 } 375 }
376 } 376 }
377 ret = pJbig2Moudle->StartDecode(m_pJbig2Context, m_Width, m_Height, m_pStreamAcc->GetData(), m_pStreamAcc->GetSize(), 377 ret = pJbig2Module->StartDecode(m_pJbig2Context, m_Width, m_Height, m_pStreamAcc->GetData(), m_pStreamAcc->GetSize(),
378 m_pGlobalStream ? m_pGlobalStream->G etData() : NULL, m_pGlobalStream ? m_pGlobalStream->GetSize() : 0, m_pCachedBitm ap->GetBuffer(), 378 m_pGlobalStream ? m_pGlobalStream->G etData() : NULL, m_pGlobalStream ? m_pGlobalStream->GetSize() : 0, m_pCachedBitm ap->GetBuffer(),
379 m_pCachedBitmap->GetPitch(), pPause) ; 379 m_pCachedBitmap->GetPitch(), pPause) ;
380 if (ret < 0) { 380 if (ret < 0) {
381 delete m_pCachedBitmap; 381 delete m_pCachedBitmap;
382 m_pCachedBitmap = NULL; 382 m_pCachedBitmap = NULL;
383 delete m_pGlobalStream; 383 delete m_pGlobalStream;
384 m_pGlobalStream = NULL; 384 m_pGlobalStream = NULL;
385 pJbig2Moudle->DestroyJbig2Context(m_pJbig2Context); 385 pJbig2Module->DestroyJbig2Context(m_pJbig2Context);
386 m_pJbig2Context = NULL; 386 m_pJbig2Context = NULL;
387 return 0; 387 return 0;
388 } 388 }
389 if (ret == FXCODEC_STATUS_DECODE_TOBECONTINUE) { 389 if (ret == FXCODEC_STATUS_DECODE_TOBECONTINUE) {
390 return 2; 390 return 2;
391 } 391 }
392 int ret1 = 1; 392 int ret1 = 1;
393 if (m_bHasMask) { 393 if (m_bHasMask) {
394 ret1 = ContinueLoadMaskDIB(pPause); 394 ret1 = ContinueLoadMaskDIB(pPause);
395 m_Status = 2; 395 m_Status = 2;
396 } 396 }
397 if (ret1 == 2) { 397 if (ret1 == 2) {
398 return ret1; 398 return ret1;
399 } 399 }
400 if (m_pColorSpace && m_bStdCS) { 400 if (m_pColorSpace && m_bStdCS) {
401 m_pColorSpace->EnableStdConversion(FALSE); 401 m_pColorSpace->EnableStdConversion(FALSE);
402 } 402 }
403 return ret1; 403 return ret1;
404 } 404 }
405 FXCODEC_STATUS ret = pJbig2Moudle->ContinueDecode(m_pJbig2Context, pPaus e); 405 FXCODEC_STATUS ret = pJbig2Module->ContinueDecode(m_pJbig2Context, pPaus e);
406 if (ret < 0) { 406 if (ret < 0) {
407 delete m_pCachedBitmap; 407 delete m_pCachedBitmap;
408 m_pCachedBitmap = NULL; 408 m_pCachedBitmap = NULL;
409 delete m_pGlobalStream; 409 delete m_pGlobalStream;
410 m_pGlobalStream = NULL; 410 m_pGlobalStream = NULL;
411 pJbig2Moudle->DestroyJbig2Context(m_pJbig2Context); 411 pJbig2Module->DestroyJbig2Context(m_pJbig2Context);
412 m_pJbig2Context = NULL; 412 m_pJbig2Context = NULL;
413 return 0; 413 return 0;
414 } 414 }
415 if (ret == FXCODEC_STATUS_DECODE_TOBECONTINUE) { 415 if (ret == FXCODEC_STATUS_DECODE_TOBECONTINUE) {
416 return 2; 416 return 2;
417 } 417 }
418 int ret1 = 1; 418 int ret1 = 1;
419 if (m_bHasMask) { 419 if (m_bHasMask) {
420 ret1 = ContinueLoadMaskDIB(pPause); 420 ret1 = ContinueLoadMaskDIB(pPause);
421 m_Status = 2; 421 m_Status = 2;
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 } else { 882 } else {
883 m_pColorSpace->GetRGB(color_value, R, G, B); 883 m_pColorSpace->GetRGB(color_value, R, G, B);
884 } 884 }
885 SetPaletteArgb(i, ArgbEncode(255, FXSYS_round(R * 255), FXSYS_round( G * 255), FXSYS_round(B * 255))); 885 SetPaletteArgb(i, ArgbEncode(255, FXSYS_round(R * 255), FXSYS_round( G * 255), FXSYS_round(B * 255)));
886 } 886 }
887 } 887 }
888 } 888 }
889 void CPDF_DIBSource::ValidateDictParam() 889 void CPDF_DIBSource::ValidateDictParam()
890 { 890 {
891 m_bpc = m_bpc_orig; 891 m_bpc = m_bpc_orig;
892 » CPDF_Object * pFilter = m_pDict->GetElementValue(FX_BSTRC("Filter")); 892 CPDF_Object * pFilter = m_pDict->GetElementValue(FX_BSTRC("Filter"));
893 if (pFilter) { 893 if (pFilter) {
894 if (pFilter->GetType() == PDFOBJ_NAME) { 894 if (pFilter->GetType() == PDFOBJ_NAME) {
895 CFX_ByteString filter = pFilter->GetString(); 895 CFX_ByteString filter = pFilter->GetString();
896 if (filter == FX_BSTRC("CCITTFaxDecode") || filter == FX_BSTRC("JBIG 2Decode")) { 896 if (filter == FX_BSTRC("CCITTFaxDecode") || filter == FX_BSTRC("JBIG 2Decode")) {
897 m_bpc = 1; 897 m_bpc = 1;
898 m_nComponents = 1; 898 m_nComponents = 1;
899 } 899 }
900 if (filter == FX_BSTRC("RunLengthDecode") || filter == FX_BSTRC("DCT Decode")) { 900 if (filter == FX_BSTRC("RunLengthDecode") || filter == FX_BSTRC("DCT Decode")) {
901 m_bpc = 8; 901 m_bpc = 8;
902 } 902 }
903 } else if (pFilter->GetType() == PDFOBJ_ARRAY) { 903 } else if (pFilter->GetType() == PDFOBJ_ARRAY) {
904 CPDF_Array *pArray = (CPDF_Array *)pFilter; 904 CPDF_Array *pArray = (CPDF_Array *)pFilter;
905 if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("CCITTFacD ecode") || 905 if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("CCITTFaxD ecode") ||
906 pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("JBIG2 Decode")) { 906 pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("JBIG2 Decode")) {
907 m_bpc = 1; 907 m_bpc = 1;
908 m_nComponents = 1; 908 m_nComponents = 1;
909 } 909 }
910 if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("DCTDecode ")) { 910 if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("DCTDecode ")) {
911 // Previously, pArray->GetString(pArray->GetCount() - 1) == FX_B STRC("RunLengthDecode") was checked in the "if" statement as well, 911 // Previously, pArray->GetString(pArray->GetCount() - 1) == FX_B STRC("RunLengthDecode") was checked in the "if" statement as well,
912 // but too many documents don't conform to it. 912 // but too many documents don't conform to it.
913 m_bpc = 8; 913 m_bpc = 8;
914 } 914 }
915 } 915 }
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 { 1509 {
1510 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); 1510 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause);
1511 } 1511 }
1512 CPDF_ImageLoader::~CPDF_ImageLoader() 1512 CPDF_ImageLoader::~CPDF_ImageLoader()
1513 { 1513 {
1514 if (!m_bCached) { 1514 if (!m_bCached) {
1515 delete m_pBitmap; 1515 delete m_pBitmap;
1516 delete m_pMask; 1516 delete m_pMask;
1517 } 1517 }
1518 } 1518 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698