Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2386)

Unified Diff: core/fpdfapi/page/cpdf_image.cpp

Issue 2517163003: Use more unique_ptrs in CPDF_Image. (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/page/cpdf_image.h ('k') | core/fpdfapi/page/cpdf_imageobject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/page/cpdf_image.cpp
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index dafca2b764c71ff76761f475a90e67c29ae8b774..8a5faa6d0ad961eaac940dc57e04d27d4b023735 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);
« no previous file with comments | « core/fpdfapi/page/cpdf_image.h ('k') | core/fpdfapi/page/cpdf_imageobject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698