diff options
-rw-r--r-- | core/fpdfapi/font/cpdf_type3char.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_image.cpp | 20 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_image.h | 10 |
3 files changed, 17 insertions, 17 deletions
diff --git a/core/fpdfapi/font/cpdf_type3char.cpp b/core/fpdfapi/font/cpdf_type3char.cpp index 41ab824717..5eb12c1752 100644 --- a/core/fpdfapi/font/cpdf_type3char.cpp +++ b/core/fpdfapi/font/cpdf_type3char.cpp @@ -29,8 +29,8 @@ bool CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext) { return false; m_ImageMatrix = pPageObj->AsImage()->matrix(); - std::unique_ptr<CFX_DIBSource> pSource( - pPageObj->AsImage()->GetImage()->LoadDIBSource()); + std::unique_ptr<CFX_DIBSource> pSource = + pPageObj->AsImage()->GetImage()->LoadDIBSource(); if (pSource) m_pBitmap = pSource->Clone(); m_pForm.reset(); diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index c910319aba..feafde3b36 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -322,18 +322,18 @@ void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) { pPage->GetRenderCache()->ResetBitmap(m_pStream.Get(), pBitmap); } -CFX_DIBSource* CPDF_Image::LoadDIBSource(CFX_DIBSource** ppMask, - uint32_t* pMatteColor, - bool bStdCS, - uint32_t GroupFamily, - bool bLoadMask) const { +std::unique_ptr<CFX_DIBSource> CPDF_Image::LoadDIBSource(CFX_DIBSource** ppMask, + uint32_t* pMatteColor, + bool bStdCS, + uint32_t GroupFamily, + bool bLoadMask) const { auto source = pdfium::MakeUnique<CPDF_DIBSource>(); - if (source->Load(m_pDocument, m_pStream.Get(), - reinterpret_cast<CPDF_DIBSource**>(ppMask), pMatteColor, - nullptr, nullptr, bStdCS, GroupFamily, bLoadMask)) { - return source.release(); + if (!source->Load(m_pDocument, m_pStream.Get(), + reinterpret_cast<CPDF_DIBSource**>(ppMask), pMatteColor, + nullptr, nullptr, bStdCS, GroupFamily, bLoadMask)) { + return nullptr; } - return nullptr; + return std::move(source); } CFX_DIBSource* CPDF_Image::DetachBitmap() { diff --git a/core/fpdfapi/page/cpdf_image.h b/core/fpdfapi/page/cpdf_image.h index e0fc761b38..6591897d1e 100644 --- a/core/fpdfapi/page/cpdf_image.h +++ b/core/fpdfapi/page/cpdf_image.h @@ -44,11 +44,11 @@ class CPDF_Image { bool IsMask() const { return m_bIsMask; } bool IsInterpol() const { return m_bInterpolate; } - CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = nullptr, - uint32_t* pMatteColor = nullptr, - bool bStdCS = false, - uint32_t GroupFamily = 0, - bool bLoadMask = false) const; + std::unique_ptr<CFX_DIBSource> LoadDIBSource(CFX_DIBSource** ppMask = nullptr, + uint32_t* pMatteColor = nullptr, + bool bStdCS = false, + uint32_t GroupFamily = 0, + bool bLoadMask = false) const; void SetImage(const CFX_DIBitmap* pDIBitmap); void SetJpegImage(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile); |