diff options
author | thestig <thestig@chromium.org> | 2016-11-21 16:52:41 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-21 16:52:41 -0800 |
commit | 6a1c9bd09ef8fdd2fe2f9e39b9a05f6581be9d87 (patch) | |
tree | e909f7f4a56ac319f58865e42d0406de7c65c690 /core/fpdfapi/page/cpdf_image.cpp | |
parent | 06104a8abc71ecd824d6a461b6f6f31c32fd2135 (diff) | |
download | pdfium-6a1c9bd09ef8fdd2fe2f9e39b9a05f6581be9d87.tar.xz |
Use more unique_ptrs in CPDF_Image.
Do the same in CPDF_TextObject.
Discover CPDF_PageObject::Clone() is unnecessary and remove it.
Review-Url: https://codereview.chromium.org/2517163003
Diffstat (limited to 'core/fpdfapi/page/cpdf_image.cpp')
-rw-r--r-- | core/fpdfapi/page/cpdf_image.cpp | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index dafca2b764..8a5faa6d0a 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -61,24 +61,6 @@ void CPDF_Image::FinishInitialization() { m_Width = m_pDict->GetIntegerFor("Width"); } -CPDF_Image* CPDF_Image::Clone() { - CPDF_Image* pImage = new CPDF_Image(m_pDocument); - pImage->m_bIsInline = m_bIsInline; - if (m_pOwnedStream) { - pImage->m_pOwnedStream = ToStream(m_pOwnedStream->Clone()); - pImage->m_pStream = pImage->m_pOwnedStream.get(); - } else { - pImage->m_pStream = m_pStream; - } - if (m_pOwnedDict) { - pImage->m_pOwnedDict = ToDictionary(m_pOwnedDict->Clone()); - pImage->m_pDict = pImage->m_pOwnedDict.get(); - } else { - pImage->m_pDict = m_pDict; - } - return pImage; -} - void CPDF_Image::ConvertStreamToIndirectObject() { if (!m_pStream->IsInline()) return; @@ -329,7 +311,7 @@ CFX_DIBSource* CPDF_Image::LoadDIBSource(CFX_DIBSource** ppMask, bool bStdCS, uint32_t GroupFamily, bool bLoadMask) const { - std::unique_ptr<CPDF_DIBSource> source(new CPDF_DIBSource); + auto source = pdfium::MakeUnique<CPDF_DIBSource>(); if (source->Load(m_pDocument, m_pStream, reinterpret_cast<CPDF_DIBSource**>(ppMask), pMatteColor, nullptr, nullptr, bStdCS, GroupFamily, bLoadMask)) { @@ -355,7 +337,7 @@ bool CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource, bool bStdCS, uint32_t GroupFamily, bool bLoadMask) { - std::unique_ptr<CPDF_DIBSource> source(new CPDF_DIBSource); + auto source = pdfium::MakeUnique<CPDF_DIBSource>(); int ret = source->StartLoadDIBSource(m_pDocument, m_pStream, true, pFormResource, pPageResource, bStdCS, GroupFamily, bLoadMask); |