diff options
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r-- | core/fpdfapi/page/cpdf_contentparser.cpp | 15 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_form.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_page.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_tilingpattern.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/page/fpdf_page_func.cpp | 11 |
5 files changed, 20 insertions, 15 deletions
diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp index 0b8574bfd4..1e0fe62e09 100644 --- a/core/fpdfapi/page/cpdf_contentparser.cpp +++ b/core/fpdfapi/page/cpdf_contentparser.cpp @@ -17,6 +17,7 @@ #include "core/fpdfapi/parser/cpdf_stream.h" #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "core/fxcrt/fx_safe_types.h" +#include "third_party/base/ptr_util.h" #define PARSE_STEP_LIMIT 100 @@ -54,7 +55,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage) { } if (CPDF_Stream* pStream = pContent->AsStream()) { m_nStreams = 0; - m_pSingleStream.reset(new CPDF_StreamAcc); + m_pSingleStream = pdfium::MakeUnique<CPDF_StreamAcc>(); m_pSingleStream->LoadAllData(pStream, false); } else if (CPDF_Array* pArray = pContent->AsArray()) { m_nStreams = pArray->GetCount(); @@ -94,9 +95,9 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, form_bbox.Transform(pParentMatrix); } CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDictFor("Resources"); - m_pParser.reset(new CPDF_StreamContentParser( + m_pParser = pdfium::MakeUnique<CPDF_StreamContentParser>( pForm->m_pDocument, pForm->m_pPageResources, pForm->m_pResources, - pParentMatrix, pForm, pResources, &form_bbox, pGraphicStates, level)); + pParentMatrix, pForm, pResources, &form_bbox, pGraphicStates, level); m_pParser->GetCurStates()->m_CTM = form_matrix; m_pParser->GetCurStates()->m_ParentMatrix = form_matrix; if (ClipPath) { @@ -111,7 +112,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, pState->SetSoftMask(nullptr); } m_nStreams = 0; - m_pSingleStream.reset(new CPDF_StreamAcc); + m_pSingleStream = pdfium::MakeUnique<CPDF_StreamAcc>(); m_pSingleStream->LoadAllData(pForm->m_pFormStream, false); m_pData = (uint8_t*)m_pSingleStream->GetData(); m_Size = m_pSingleStream->GetSize(); @@ -153,7 +154,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) { } else { CPDF_Array* pContent = m_pObjectHolder->m_pFormDict->GetArrayFor("Contents"); - m_StreamArray[m_CurrentOffset].reset(new CPDF_StreamAcc); + m_StreamArray[m_CurrentOffset] = pdfium::MakeUnique<CPDF_StreamAcc>(); CPDF_Stream* pStreamObj = ToStream( pContent ? pContent->GetDirectObjectAt(m_CurrentOffset) : nullptr); m_StreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, false); @@ -162,10 +163,10 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) { } if (m_InternalStage == STAGE_PARSE) { if (!m_pParser) { - m_pParser.reset(new CPDF_StreamContentParser( + m_pParser = pdfium::MakeUnique<CPDF_StreamContentParser>( m_pObjectHolder->m_pDocument, m_pObjectHolder->m_pPageResources, nullptr, nullptr, m_pObjectHolder, m_pObjectHolder->m_pResources, - &m_pObjectHolder->m_BBox, nullptr, 0)); + &m_pObjectHolder->m_BBox, nullptr, 0); m_pParser->GetCurStates()->m_ColorState.SetDefault(); } if (m_CurrentOffset >= m_Size) { diff --git a/core/fpdfapi/page/cpdf_form.cpp b/core/fpdfapi/page/cpdf_form.cpp index 3a5fa0a74a..b3f2b372e3 100644 --- a/core/fpdfapi/page/cpdf_form.cpp +++ b/core/fpdfapi/page/cpdf_form.cpp @@ -12,6 +12,7 @@ #include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_stream.h" +#include "third_party/base/ptr_util.h" CPDF_Form::CPDF_Form(CPDF_Document* pDoc, CPDF_Dictionary* pPageResources, @@ -39,7 +40,7 @@ void CPDF_Form::StartParse(CPDF_AllStates* pGraphicStates, if (m_ParseState == CONTENT_PARSED || m_ParseState == CONTENT_PARSING) return; - m_pParser.reset(new CPDF_ContentParser); + m_pParser = pdfium::MakeUnique<CPDF_ContentParser>(); m_pParser->Start(this, pGraphicStates, pParentMatrix, pType3Char, level); m_ParseState = CONTENT_PARSING; } diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp index b4e2e67939..f9c02837a7 100644 --- a/core/fpdfapi/page/cpdf_page.cpp +++ b/core/fpdfapi/page/cpdf_page.cpp @@ -17,6 +17,7 @@ #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_object.h" #include "core/fpdfapi/render/cpdf_pagerendercache.h" +#include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" CPDF_Page::CPDF_Page(CPDF_Document* pDocument, @@ -88,7 +89,7 @@ void CPDF_Page::StartParse() { if (m_ParseState == CONTENT_PARSED || m_ParseState == CONTENT_PARSING) return; - m_pParser.reset(new CPDF_ContentParser); + m_pParser = pdfium::MakeUnique<CPDF_ContentParser>(); m_pParser->Start(this); m_ParseState = CONTENT_PARSING; } diff --git a/core/fpdfapi/page/cpdf_tilingpattern.cpp b/core/fpdfapi/page/cpdf_tilingpattern.cpp index 1b7bee4366..a041f38074 100644 --- a/core/fpdfapi/page/cpdf_tilingpattern.cpp +++ b/core/fpdfapi/page/cpdf_tilingpattern.cpp @@ -10,6 +10,7 @@ #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_object.h" #include "core/fpdfapi/parser/cpdf_stream.h" +#include "third_party/base/ptr_util.h" CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, @@ -47,7 +48,7 @@ bool CPDF_TilingPattern::Load() { if (!pStream) return false; - m_pForm.reset(new CPDF_Form(m_pDocument, nullptr, pStream)); + m_pForm = pdfium::MakeUnique<CPDF_Form>(m_pDocument, nullptr, pStream); m_pForm->ParseContent(nullptr, &m_ParentMatrix, nullptr); m_BBox = pDict->GetRectFor("BBox"); return true; diff --git a/core/fpdfapi/page/fpdf_page_func.cpp b/core/fpdfapi/page/fpdf_page_func.cpp index a6c73b0e5f..672bfc02be 100644 --- a/core/fpdfapi/page/fpdf_page_func.cpp +++ b/core/fpdfapi/page/fpdf_page_func.cpp @@ -20,6 +20,7 @@ #include "core/fpdfapi/parser/cpdf_stream.h" #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "core/fxcrt/fx_safe_types.h" +#include "third_party/base/ptr_util.h" namespace { @@ -495,7 +496,7 @@ bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { return false; m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample); - m_pSampleStream.reset(new CPDF_StreamAcc); + m_pSampleStream = pdfium::MakeUnique<CPDF_StreamAcc>(); m_pSampleStream->LoadAllData(pStream, false); FX_SAFE_UINT32 nTotalSampleBits = 1; m_EncodeInfo.resize(m_nInputs); @@ -742,13 +743,13 @@ std::unique_ptr<CPDF_Function> CPDF_Function::Load(CPDF_Object* pFuncObj) { Type type = IntegerToFunctionType(iType); if (type == Type::kType0Sampled) - pFunc.reset(new CPDF_SampledFunc()); + pFunc = pdfium::MakeUnique<CPDF_SampledFunc>(); else if (type == Type::kType2ExpotentialInterpolation) - pFunc.reset(new CPDF_ExpIntFunc()); + pFunc = pdfium::MakeUnique<CPDF_ExpIntFunc>(); else if (type == Type::kType3Stitching) - pFunc.reset(new CPDF_StitchFunc()); + pFunc = pdfium::MakeUnique<CPDF_StitchFunc>(); else if (type == Type::kType4PostScript) - pFunc.reset(new CPDF_PSFunc()); + pFunc = pdfium::MakeUnique<CPDF_PSFunc>(); if (!pFunc || !pFunc->Init(pFuncObj)) return nullptr; |