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

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

Issue 1380243004: Various changes to JBig2 cache: (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Addressed comment Created 5 years, 2 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 | « core/include/fxcodec/fx_codec.h ('k') | core/src/fxcodec/codec/codec_int.h » ('j') | 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 <vector> 7 #include <vector>
8 8
9 #include "../../../../third_party/base/nonstd_unique_ptr.h" 9 #include "../../../../third_party/base/nonstd_unique_ptr.h"
10 #include "../../../include/fpdfapi/fpdf_module.h" 10 #include "../../../include/fpdfapi/fpdf_module.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 if (m_pJbig2Context == NULL) { 400 if (m_pJbig2Context == NULL) {
401 m_pJbig2Context = pJbig2Module->CreateJbig2Context(); 401 m_pJbig2Context = pJbig2Module->CreateJbig2Context();
402 if (m_pStreamAcc->GetImageParam()) { 402 if (m_pStreamAcc->GetImageParam()) {
403 CPDF_Stream* pGlobals = 403 CPDF_Stream* pGlobals =
404 m_pStreamAcc->GetImageParam()->GetStream(FX_BSTRC("JBIG2Globals")); 404 m_pStreamAcc->GetImageParam()->GetStream(FX_BSTRC("JBIG2Globals"));
405 if (pGlobals) { 405 if (pGlobals) {
406 m_pGlobalStream = new CPDF_StreamAcc; 406 m_pGlobalStream = new CPDF_StreamAcc;
407 m_pGlobalStream->LoadAllData(pGlobals, FALSE); 407 m_pGlobalStream->LoadAllData(pGlobals, FALSE);
408 } 408 }
409 } 409 }
410 ret = pJbig2Module->StartDecode( 410 ret = pJbig2Module->StartDecode(m_pJbig2Context, m_pDocument, m_Width,
411 m_pJbig2Context, m_Width, m_Height, m_pStreamAcc->GetData(), 411 m_Height, m_pStreamAcc, m_pGlobalStream,
412 m_pStreamAcc->GetSize(), 412 m_pCachedBitmap->GetBuffer(),
413 m_pGlobalStream ? m_pGlobalStream->GetData() : NULL, 413 m_pCachedBitmap->GetPitch(), pPause);
414 m_pGlobalStream ? m_pGlobalStream->GetSize() : 0,
415 m_pCachedBitmap->GetBuffer(), m_pCachedBitmap->GetPitch(), pPause);
416 if (ret < 0) { 414 if (ret < 0) {
417 m_pCachedBitmap.reset(); 415 m_pCachedBitmap.reset();
418 delete m_pGlobalStream; 416 delete m_pGlobalStream;
419 m_pGlobalStream = NULL; 417 m_pGlobalStream = NULL;
420 pJbig2Module->DestroyJbig2Context(m_pJbig2Context); 418 pJbig2Module->DestroyJbig2Context(m_pJbig2Context);
421 m_pJbig2Context = NULL; 419 m_pJbig2Context = NULL;
422 return 0; 420 return 0;
423 } 421 }
424 if (ret == FXCODEC_STATUS_DECODE_TOBECONTINUE) { 422 if (ret == FXCODEC_STATUS_DECODE_TOBECONTINUE) {
425 return 2; 423 return 2;
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 } 1655 }
1658 FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) { 1656 FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) {
1659 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); 1657 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause);
1660 } 1658 }
1661 CPDF_ImageLoader::~CPDF_ImageLoader() { 1659 CPDF_ImageLoader::~CPDF_ImageLoader() {
1662 if (!m_bCached) { 1660 if (!m_bCached) {
1663 delete m_pBitmap; 1661 delete m_pBitmap;
1664 delete m_pMask; 1662 delete m_pMask;
1665 } 1663 }
1666 } 1664 }
OLDNEW
« no previous file with comments | « core/include/fxcodec/fx_codec.h ('k') | core/src/fxcodec/codec/codec_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698