diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-08-28 23:15:02 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-28 23:15:02 +0000 |
commit | b719bc4a6f219483059f66c33e4a3a7667d75ed5 (patch) | |
tree | bb1f512fd303b46dab323e849e56d21779d32488 /core/fpdfapi/render | |
parent | da379c7af512aa7baa221d38b04c8aa9912b4e02 (diff) | |
download | pdfium-b719bc4a6f219483059f66c33e4a3a7667d75ed5.tar.xz |
Use pdfium::span<> in more image modules
Change-Id: Ie344bb37abf7dde158d03cc2897dca3588f1a5e3
Reviewed-on: https://pdfium-review.googlesource.com/41550
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r-- | core/fpdfapi/render/cpdf_dibbase.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/core/fpdfapi/render/cpdf_dibbase.cpp b/core/fpdfapi/render/cpdf_dibbase.cpp index dd710f6e75..70aea8e45b 100644 --- a/core/fpdfapi/render/cpdf_dibbase.cpp +++ b/core/fpdfapi/render/cpdf_dibbase.cpp @@ -470,21 +470,19 @@ CPDF_DIBBase::LoadState CPDF_DIBBase::CreateDecoder() { return LoadState::kContinue; } - const uint8_t* src_data = m_pStreamAcc->GetData(); - uint32_t src_size = m_pStreamAcc->GetSize(); + pdfium::span<const uint8_t> src_span = m_pStreamAcc->GetSpan(); const CPDF_Dictionary* pParams = m_pStreamAcc->GetImageParam(); if (decoder == "CCITTFaxDecode") { - m_pDecoder = FPDFAPI_CreateFaxDecoder(src_data, src_size, m_Width, m_Height, - pParams); + m_pDecoder = FPDFAPI_CreateFaxDecoder(src_span, m_Width, m_Height, pParams); } else if (decoder == "FlateDecode") { - m_pDecoder = FPDFAPI_CreateFlateDecoder( - src_data, src_size, m_Width, m_Height, m_nComponents, m_bpc, pParams); + m_pDecoder = FPDFAPI_CreateFlateDecoder(src_span, m_Width, m_Height, + m_nComponents, m_bpc, pParams); } else if (decoder == "RunLengthDecode") { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); m_pDecoder = pEncoders->GetBasicModule()->CreateRunLengthDecoder( - {src_data, src_size}, m_Width, m_Height, m_nComponents, m_bpc); + src_span, m_Width, m_Height, m_nComponents, m_bpc); } else if (decoder == "DCTDecode") { - if (!CreateDCTDecoder({src_data, src_size}, pParams)) + if (!CreateDCTDecoder(src_span, pParams)) return LoadState::kFail; } if (!m_pDecoder) @@ -576,8 +574,8 @@ bool CPDF_DIBBase::CreateDCTDecoder(pdfium::span<const uint8_t> src_span, RetainPtr<CFX_DIBitmap> CPDF_DIBBase::LoadJpxBitmap() { CCodec_JpxModule* pJpxModule = CPDF_ModuleMgr::Get()->GetJpxModule(); auto context = pdfium::MakeUnique<JpxBitMapContext>(pJpxModule); - context->set_decoder(pJpxModule->CreateDecoder( - m_pStreamAcc->GetData(), m_pStreamAcc->GetSize(), m_pColorSpace.Get())); + context->set_decoder( + pJpxModule->CreateDecoder(m_pStreamAcc->GetSpan(), m_pColorSpace.Get())); if (!context->decoder()) return nullptr; |