diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-04-04 14:37:18 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-04 21:48:48 +0000 |
commit | afd0d1f488ea55da545b3310fd8f22e45522a695 (patch) | |
tree | 89136eba4669421b6f828edb9f3d69ee558110d0 /core/fpdfapi/render/cpdf_dibsource.cpp | |
parent | 4f8b044b95dc282959dfe41453e2a9c1ec7e9354 (diff) | |
download | pdfium-afd0d1f488ea55da545b3310fd8f22e45522a695.tar.xz |
RefCount CPDF_StreamAcc all the time.
Pass stream argument to constructor; it feels like a
stream accessor should always be made from a stream rather
than passing one in after the fact.
Change-Id: Iaa46cb37677b81f0170f5d39bab76ad38ea4af44
Reviewed-on: https://pdfium-review.googlesource.com/3620
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/render/cpdf_dibsource.cpp')
-rw-r--r-- | core/fpdfapi/render/cpdf_dibsource.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp index 12bfadb19d..e60d0329d0 100644 --- a/core/fpdfapi/render/cpdf_dibsource.cpp +++ b/core/fpdfapi/render/cpdf_dibsource.cpp @@ -165,8 +165,8 @@ bool CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream) { if (!src_size.IsValid()) return false; - m_pStreamAcc = pdfium::MakeUnique<CPDF_StreamAcc>(); - m_pStreamAcc->LoadAllData(pStream, false, src_size.ValueOrDie(), true); + m_pStreamAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream); + m_pStreamAcc->LoadAllData(false, src_size.ValueOrDie(), true); if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData()) return false; @@ -278,8 +278,8 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, if (!src_size.IsValid()) { return 0; } - m_pStreamAcc = pdfium::MakeUnique<CPDF_StreamAcc>(); - m_pStreamAcc->LoadAllData(pStream, false, src_size.ValueOrDie(), true); + m_pStreamAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream); + m_pStreamAcc->LoadAllData(false, src_size.ValueOrDie(), true); if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData()) { return 0; } @@ -325,17 +325,17 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) { CPDF_Stream* pGlobals = m_pStreamAcc->GetImageParam()->GetStreamFor("JBIG2Globals"); if (pGlobals) { - m_pGlobalStream = pdfium::MakeUnique<CPDF_StreamAcc>(); - m_pGlobalStream->LoadAllData(pGlobals, false); + m_pGlobalStream = pdfium::MakeRetain<CPDF_StreamAcc>(pGlobals); + m_pGlobalStream->LoadAllData(false); } } ret = pJbig2Module->StartDecode( m_pJbig2Context.get(), m_pDocument->CodecContext(), m_Width, m_Height, - m_pStreamAcc.get(), m_pGlobalStream.get(), - m_pCachedBitmap->GetBuffer(), m_pCachedBitmap->GetPitch(), pPause); + m_pStreamAcc, m_pGlobalStream, m_pCachedBitmap->GetBuffer(), + m_pCachedBitmap->GetPitch(), pPause); if (ret < 0) { m_pCachedBitmap.Reset(); - m_pGlobalStream.reset(); + m_pGlobalStream.Reset(); m_pJbig2Context.reset(); return 0; } @@ -358,7 +358,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) { ret = pJbig2Module->ContinueDecode(m_pJbig2Context.get(), pPause); if (ret < 0) { m_pCachedBitmap.Reset(); - m_pGlobalStream.reset(); + m_pGlobalStream.Reset(); m_pJbig2Context.reset(); return 0; } |