diff options
author | Lei Zhang <thestig@chromium.org> | 2017-05-18 15:51:20 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-19 01:39:40 +0000 |
commit | 76020fc9751e55661d1c01b6cd92dfcb1fd56e6a (patch) | |
tree | 59d5251b23f5acb78891bf2911a79f2c70812c1c /core/fpdfapi/render | |
parent | 22644731e0e46eae1f50927376e557c7d64db1d5 (diff) | |
download | pdfium-76020fc9751e55661d1c01b6cd92dfcb1fd56e6a.tar.xz |
Move CCodec_ModuleMgr ownership to CPDF_ModuleMgr.
More straight forward than CFX_GEModule owning in and CPDF_ModuleMgr
holding a pointer to it.
Remove assumptions that the codec modules may return nullptr, and do
IWYU.
Change-Id: Iba7fc3c7ec223fd6d29a1ab74ed13d35689bc5d5
Reviewed-on: https://pdfium-review.googlesource.com/5654
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r-- | core/fpdfapi/render/cpdf_dibsource.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp index f1c58038e8..3bb91ecf1b 100644 --- a/core/fpdfapi/render/cpdf_dibsource.cpp +++ b/core/fpdfapi/render/cpdf_dibsource.cpp @@ -531,11 +531,9 @@ int CPDF_DIBSource::CreateDecoder() { m_pDecoder = FPDFAPI_CreateFlateDecoder( src_data, src_size, m_Width, m_Height, m_nComponents, m_bpc, pParams); } else if (decoder == "RunLengthDecode") { - m_pDecoder = CPDF_ModuleMgr::Get() - ->GetCodecModule() - ->GetBasicModule() - ->CreateRunLengthDecoder(src_data, src_size, m_Width, - m_Height, m_nComponents, m_bpc); + CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); + m_pDecoder = pEncoders->GetBasicModule()->CreateRunLengthDecoder( + src_data, src_size, m_Width, m_Height, m_nComponents, m_bpc); } else if (decoder == "DCTDecode") { if (!CreateDCTDecoder(src_data, src_size, pParams)) return 0; @@ -559,7 +557,8 @@ int CPDF_DIBSource::CreateDecoder() { bool CPDF_DIBSource::CreateDCTDecoder(const uint8_t* src_data, uint32_t src_size, const CPDF_Dictionary* pParams) { - m_pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder( + CCodec_JpegModule* pJpegModule = CPDF_ModuleMgr::Get()->GetJpegModule(); + m_pDecoder = pJpegModule->CreateDecoder( src_data, src_size, m_Width, m_Height, m_nComponents, !pParams || pParams->GetIntegerFor("ColorTransform", 1)); if (m_pDecoder) @@ -568,7 +567,6 @@ bool CPDF_DIBSource::CreateDCTDecoder(const uint8_t* src_data, bool bTransform = false; int comps; int bpc; - CCodec_JpegModule* pJpegModule = CPDF_ModuleMgr::Get()->GetJpegModule(); if (!pJpegModule->LoadInfo(src_data, src_size, &m_Width, &m_Height, &comps, &bpc, &bTransform)) { return false; @@ -576,7 +574,7 @@ bool CPDF_DIBSource::CreateDCTDecoder(const uint8_t* src_data, if (m_nComponents == static_cast<uint32_t>(comps)) { m_bpc = bpc; - m_pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder( + m_pDecoder = pJpegModule->CreateDecoder( src_data, src_size, m_Width, m_Height, m_nComponents, bTransform); return true; } @@ -624,16 +622,13 @@ bool CPDF_DIBSource::CreateDCTDecoder(const uint8_t* src_data, return false; m_bpc = bpc; - m_pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder( - src_data, src_size, m_Width, m_Height, m_nComponents, bTransform); + m_pDecoder = pJpegModule->CreateDecoder(src_data, src_size, m_Width, m_Height, + m_nComponents, bTransform); return true; } void CPDF_DIBSource::LoadJpxBitmap() { CCodec_JpxModule* pJpxModule = CPDF_ModuleMgr::Get()->GetJpxModule(); - if (!pJpxModule) - return; - auto context = pdfium::MakeUnique<JpxBitMapContext>(pJpxModule); context->set_decoder(pJpxModule->CreateDecoder( m_pStreamAcc->GetData(), m_pStreamAcc->GetSize(), m_pColorSpace)); |