diff options
author | Lei Zhang <thestig@chromium.org> | 2015-12-24 19:13:32 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-12-24 19:13:32 -0800 |
commit | aa8bf7e42b8c73a9bc07ed6781364ba05f5a9776 (patch) | |
tree | a5a435608eb527db39e2c9324737bd230e762030 /core/src/fpdfapi | |
parent | 25ae22692cdd5b4ae4783ecb27eba79b3c794b2c (diff) | |
download | pdfium-aa8bf7e42b8c73a9bc07ed6781364ba05f5a9776.tar.xz |
Merge to XFA: Switch from nonstd::unique_ptr to std::unique_ptr.
TBR=thakis@chromium.org
Review URL: https://codereview.chromium.org/1547833002 .
(cherry picked from commit d20dfba2ae10e8aeb328328f09da79ff904110a8)
Review URL: https://codereview.chromium.org/1545183002 .
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_font/ttgsubtable.cpp | 5 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp | 4 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/pageint.h | 4 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 30 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render.cpp | 12 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp | 12 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 9 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/render_int.h | 10 |
12 files changed, 47 insertions, 47 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 9c96a3027c..e1c39fbb16 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -846,7 +846,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { } CPDF_Dictionary* pBaseDict = new CPDF_Dictionary; pBaseDict->SetAtName("Type", "Font"); - nonstd::unique_ptr<CFX_UnicodeEncoding> pEncoding( + std::unique_ptr<CFX_UnicodeEncoding> pEncoding( new CFX_UnicodeEncoding(pFont)); CPDF_Dictionary* pFontDict = pBaseDict; if (!bCJK) { diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index a3de6f2777..003825b898 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -1700,7 +1700,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) { if (!pStream) return nullptr; - nonstd::unique_ptr<CPDF_Type3Char> pNewChar(new CPDF_Type3Char(new CPDF_Form( + std::unique_ptr<CPDF_Type3Char> pNewChar(new CPDF_Type3Char(new CPDF_Form( m_pDocument, m_pFontResources ? m_pFontResources : m_pPageResources, pStream, nullptr))); diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp index b10aa6952a..09930bee2d 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -6,9 +6,10 @@ #include "ttgsubtable.h" +#include <memory> + #include "core/include/fxge/fx_freetype.h" #include "core/include/fxge/fx_ge.h" -#include "third_party/base/nonstd_unique_ptr.h" #include "third_party/base/stl_util.h" CFX_GlyphMap::CFX_GlyphMap() {} @@ -405,7 +406,7 @@ IFX_GSUBTable* IFX_GSUBTable::Create(CFX_Font* pFont) { FXFT_Load_Sfnt_Table(pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, pFont->GetSubData(), NULL); if (!error && pFont->GetSubData()) { - nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable); + std::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable); if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->GetSubData())) { return pGsubTable.release(); } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index 118f1cd5a3..15222fc594 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -8,12 +8,12 @@ #include <limits.h> +#include <memory> #include <vector> #include "core/include/fpdfapi/fpdf_module.h" #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fxcrt/fx_safe_types.h" -#include "third_party/base/nonstd_unique_ptr.h" #include "third_party/base/numerics/safe_conversions_impl.h" class CPDF_PSEngine; @@ -768,7 +768,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { if (pSub == pObj) { return FALSE; } - nonstd::unique_ptr<CPDF_Function> pFunc(CPDF_Function::Load(pSub)); + std::unique_ptr<CPDF_Function> pFunc(CPDF_Function::Load(pSub)); if (!pFunc) { return FALSE; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index 02ac27ac0f..1c4cc24208 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -92,7 +92,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() { } CFX_ByteString key((const FX_CHAR*)m_pSyntax->GetWordBuf() + 1, m_pSyntax->GetWordSize() - 1); - nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj( + std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj( m_pSyntax->ReadNextObject()); if (!key.IsEmpty()) { FX_DWORD dwObjNum = pObj ? pObj->GetObjNum() : 0; diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h index d5a035fe2b..f41a987e34 100644 --- a/core/src/fpdfapi/fpdf_page/pageint.h +++ b/core/src/fpdfapi/fpdf_page/pageint.h @@ -8,10 +8,10 @@ #define CORE_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ #include <map> +#include <memory> #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfapi/fpdf_pageobj.h" -#include "third_party/base/nonstd_unique_ptr.h" class CPDF_AllStates; class CPDF_ParseOptions; @@ -319,7 +319,7 @@ class CPDF_StreamContentParser { FX_DWORD m_ParamStartPos; FX_DWORD m_ParamCount; CPDF_StreamParser* m_pSyntax; - nonstd::unique_ptr<CPDF_AllStates> m_pCurStates; + std::unique_ptr<CPDF_AllStates> m_pCurStates; CPDF_ContentMark m_CurContentMark; CFX_ArrayTemplate<CPDF_TextObject*> m_ClipTextList; CPDF_TextObject* m_pLastTextObject; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index 05f407bfd3..1115a1e560 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -6,6 +6,7 @@ #include "parser_int.h" +#include <memory> #include <set> #include <utility> #include <vector> @@ -16,7 +17,6 @@ #include "core/include/fxcrt/fx_ext.h" #include "core/include/fxcrt/fx_safe_types.h" #include "core/src/fpdfapi/fpdf_page/pageint.h" -#include "third_party/base/nonstd_unique_ptr.h" #include "third_party/base/stl_util.h" namespace { @@ -94,7 +94,7 @@ bool CanReadFromBitStream(const CFX_BitStream* hStream, // TODO(thestig) Using unique_ptr with ReleaseDeleter is still not ideal. // Come up or wait for something better. using ScopedFileStream = - nonstd::unique_ptr<IFX_FileStream, ReleaseDeleter<IFX_FileStream>>; + std::unique_ptr<IFX_FileStream, ReleaseDeleter<IFX_FileStream>>; FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict) { CPDF_Object* pType = pDict->GetElementValue("Type"); @@ -307,7 +307,7 @@ FX_DWORD CPDF_Parser::SetEncryptHandler() { if (!m_pSecurityHandler->OnInit(this, m_pEncryptDict)) { return err; } - nonstd::unique_ptr<CPDF_CryptoHandler> pCryptoHandler( + std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler( m_pSecurityHandler->CreateCryptoHandler()); if (!pCryptoHandler->Init(m_pEncryptDict, m_pSecurityHandler.get())) { return PDFPARSE_ERROR_HANDLER; @@ -315,7 +315,7 @@ FX_DWORD CPDF_Parser::SetEncryptHandler() { m_Syntax.SetEncrypt(pCryptoHandler.release()); } else if (m_pEncryptDict) { CFX_ByteString filter = m_pEncryptDict->GetString("Filter"); - nonstd::unique_ptr<CPDF_SecurityHandler> pSecurityHandler; + std::unique_ptr<CPDF_SecurityHandler> pSecurityHandler; FX_DWORD err = PDFPARSE_ERROR_HANDLER; if (filter == "Standard") { pSecurityHandler.reset(FPDF_CreateStandardSecurityHandler()); @@ -328,7 +328,7 @@ FX_DWORD CPDF_Parser::SetEncryptHandler() { return err; } m_pSecurityHandler = std::move(pSecurityHandler); - nonstd::unique_ptr<CPDF_CryptoHandler> pCryptoHandler( + std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler( m_pSecurityHandler->CreateCryptoHandler()); if (!pCryptoHandler->Init(m_pEncryptDict, m_pSecurityHandler.get())) { return PDFPARSE_ERROR_HANDLER; @@ -385,7 +385,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) { while (xrefpos) { CrossRefList.InsertAt(0, xrefpos); LoadCrossRefV4(xrefpos, 0, TRUE); - nonstd::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( + std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( LoadTrailerV4()); if (!pDict) return FALSE; @@ -1456,7 +1456,7 @@ CPDF_Dictionary* CPDF_Parser::LoadTrailerV4() { if (m_Syntax.GetKeyword() != "trailer") return nullptr; - nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj( + std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj( m_Syntax.GetObject(m_pDocument, 0, 0, 0)); if (!ToDictionary(pObj.get())) return nullptr; @@ -2095,7 +2095,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, int32_t nKeys = 0; FX_FILESIZE dwSignValuePos = 0; - nonstd::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( + std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( new CPDF_Dictionary); while (1) { FX_BOOL bIsNumber; @@ -2233,7 +2233,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( if (word == "[") { if (bTypeOnly) return (CPDF_Object*)PDFOBJ_ARRAY; - nonstd::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray( + std::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray( new CPDF_Array); while (CPDF_Object* pObj = GetObject(pObjList, objnum, gennum)) pArray->Add(pObj); @@ -2251,7 +2251,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( if (pContext) pContext->m_DictStart = SavedPos; - nonstd::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( + std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( new CPDF_Dictionary); while (1) { FX_BOOL bIsNumber; @@ -2271,7 +2271,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( continue; key = PDF_NameDecode(key); - nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> obj( + std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> obj( GetObject(pObjList, objnum, gennum)); if (!obj) { uint8_t ch; @@ -2884,7 +2884,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail { std::set<FX_DWORD> m_pageMapCheckState; std::set<FX_DWORD> m_pagesLoadState; - nonstd::unique_ptr<CPDF_HintTables> m_pHintTables; + std::unique_ptr<CPDF_HintTables> m_pHintTables; FX_BOOL m_bSupportHintTable; }; @@ -3599,9 +3599,9 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(IFX_DownloadHints* pHints) { return FALSE; } m_syntaxParser.InitParser(m_pFileRead, m_dwHeaderOffset); - nonstd::unique_ptr<CPDF_HintTables> pHintTables( + std::unique_ptr<CPDF_HintTables> pHintTables( new CPDF_HintTables(this, pDict)); - nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pHintStream( + std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pHintStream( ParseIndirectObjectAt(szHSStart, 0)); CPDF_Stream* pStream = ToStream(pHintStream.get()); if (pStream && pHintTables->LoadHintStream(pStream)) @@ -3981,7 +3981,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) { } ScopedFileStream file(FX_CreateMemoryStream(pBuf, (size_t)iSize, FALSE)); m_syntaxParser.InitParser(file.get(), 0); - nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pTrailer( + std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pTrailer( m_syntaxParser.GetObject(nullptr, 0, 0)); if (!pTrailer) { m_Pos += m_syntaxParser.SavePos(); diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp index 3fd8dcf35a..3014ca280e 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp @@ -97,7 +97,7 @@ class CPDF_TestParser : public CPDF_Parser { // TODO(thestig) Using unique_ptr with ReleaseDeleter is still not ideal. // Come up or wait for something better. using ScopedFileStream = - nonstd::unique_ptr<IFX_FileStream, ReleaseDeleter<IFX_FileStream>>; + std::unique_ptr<IFX_FileStream, ReleaseDeleter<IFX_FileStream>>; TEST(fpdf_parser_parser, ReadHexString) { { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index 1c46583e59..6a821ec069 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -650,7 +650,7 @@ void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, return; } - nonstd::unique_ptr<CFX_PathData> pTextClippingPath; + std::unique_ptr<CFX_PathData> pTextClippingPath; for (int i = 0; i < textcount; ++i) { CPDF_TextObject* pText = ClipPath.GetText(i); if (pText) { @@ -811,7 +811,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, int width = FXSYS_round((FX_FLOAT)rect.Width() * scaleX); int height = FXSYS_round((FX_FLOAT)rect.Height() * scaleY); CFX_FxgeDevice bitmap_device; - nonstd::unique_ptr<CFX_DIBitmap> oriDevice; + std::unique_ptr<CFX_DIBitmap> oriDevice; if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) { oriDevice.reset(new CFX_DIBitmap); if (!m_pDevice->CreateCompatibleBitmap(oriDevice.get(), width, height)) @@ -827,7 +827,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, CFX_Matrix new_matrix = *pObj2Device; new_matrix.TranslateI(-rect.left, -rect.top); new_matrix.Scale(scaleX, scaleY); - nonstd::unique_ptr<CFX_DIBitmap> pTextMask; + std::unique_ptr<CFX_DIBitmap> pTextMask; if (bTextClip) { pTextMask.reset(new CFX_DIBitmap); if (!pTextMask->Create(width, height, FXDIB_8bppMask)) @@ -861,7 +861,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, FXSYS_memcpy(&smask_matrix, pGeneralState->m_SMaskMatrix, sizeof smask_matrix); smask_matrix.Concat(*pObj2Device); - nonstd::unique_ptr<CFX_DIBSource> pSMaskSource( + std::unique_ptr<CFX_DIBSource> pSMaskSource( LoadSMask(pSMaskDict, &rect, &smask_matrix)); if (pSMaskSource) bitmap->MultiplyAlpha(pSMaskSource.get()); @@ -896,7 +896,7 @@ CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj, FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d); int width = FXSYS_round(bbox.Width() * scaleX); int height = FXSYS_round(bbox.Height() * scaleY); - nonstd::unique_ptr<CFX_DIBitmap> pBackdrop(new CFX_DIBitmap); + std::unique_ptr<CFX_DIBitmap> pBackdrop(new CFX_DIBitmap); if (bBackAlphaRequired && !m_bDropObjects) pBackdrop->Create(width, height, FXDIB_Argb); else @@ -1190,7 +1190,7 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) { return pTransferCounter->AddRef(); } - nonstd::unique_ptr<CPDF_Function> pFuncs[3]; + std::unique_ptr<CPDF_Function> pFuncs[3]; FX_BOOL bUniTransfer = TRUE; FX_BOOL bIdentity = TRUE; if (CPDF_Array* pArray = pObj->AsArray()) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index d39d30f2a3..640adb14da 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -107,7 +107,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int back_left, back_top; FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), top + pDIBitmap->GetHeight()); - nonstd::unique_ptr<CFX_DIBitmap> pBackdrop( + std::unique_ptr<CFX_DIBitmap> pBackdrop( GetBackdrop(m_pCurObj, rect, back_left, back_top, blend_mode > FXDIB_BLEND_NORMAL && bIsolated)); if (!pBackdrop) @@ -123,7 +123,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, pDIBitmap, mask_argb, 0, 0, blend_mode); } - nonstd::unique_ptr<CFX_DIBitmap> pBackdrop1(new CFX_DIBitmap); + std::unique_ptr<CFX_DIBitmap> pBackdrop1(new CFX_DIBitmap); pBackdrop1->Create(pBackdrop->GetWidth(), pBackdrop->GetHeight(), FXDIB_Rgb32); pBackdrop1->Clear((FX_DWORD)-1); @@ -760,7 +760,7 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() { FX_RECT dest_clip( dest_rect.left - image_rect.left, dest_rect.top - image_rect.top, dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top); - nonstd::unique_ptr<CFX_DIBitmap> pStretched( + std::unique_ptr<CFX_DIBitmap> pStretched( m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip)); if (pStretched) { m_pRenderStatus->CompositeDIBitmap(pStretched.get(), dest_rect.left, @@ -785,7 +785,7 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() { if (FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || FXSYS_fabs(m_ImageMatrix.c) >= 0.5f) { int left, top; - nonstd::unique_ptr<CFX_DIBitmap> pTransformed( + std::unique_ptr<CFX_DIBitmap> pTransformed( pAlphaMask->TransformTo(&m_ImageMatrix, left, top)); if (!pTransformed) return TRUE; @@ -874,7 +874,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, if (!pGroup) { return NULL; } - nonstd::unique_ptr<CPDF_Function> pFunc; + std::unique_ptr<CPDF_Function> pFunc; CPDF_Object* pFuncObj = pSMaskDict->GetElementValue("TR"); if (pFuncObj && (pFuncObj->IsDictionary() || pFuncObj->IsStream())) pFunc.reset(CPDF_Function::Load(pFuncObj)); @@ -947,7 +947,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, &options, 0, m_bDropObjects, pFormResource, TRUE, NULL, 0, pCS ? pCS->GetFamily() : 0, bLuminosity); status.RenderObjectList(&form, &matrix); - nonstd::unique_ptr<CFX_DIBitmap> pMask(new CFX_DIBitmap); + std::unique_ptr<CFX_DIBitmap> pMask(new CFX_DIBitmap); if (!pMask->Create(width, height, FXDIB_8bppMask)) return nullptr; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index 6bb8033686..c74aea9a21 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -6,6 +6,7 @@ #include "render_int.h" +#include <memory> #include <vector> #include "core/include/fpdfapi/fpdf_module.h" @@ -15,7 +16,6 @@ #include "core/include/fxcrt/fx_safe_types.h" #include "core/include/fxge/fx_ge.h" #include "core/src/fpdfapi/fpdf_page/pageint.h" -#include "third_party/base/nonstd_unique_ptr.h" namespace { @@ -63,7 +63,7 @@ bool IsAllowedBPCValue(int bpc) { return bpc == 1 || bpc == 2 || bpc == 4 || bpc == 8 || bpc == 16; } -// Wrapper class to use with nonstd::unique_ptr for CJPX_Decoder. +// Wrapper class to use with std::unique_ptr for CJPX_Decoder. class JpxBitMapContext { public: explicit JpxBitMapContext(ICodec_JpxModule* jpx_module) @@ -199,7 +199,7 @@ CFX_DIBitmap* CPDF_DIBSource::GetBitmap() const { return m_pCachedBitmap ? m_pCachedBitmap.get() : Clone(); } void CPDF_DIBSource::ReleaseBitmap(CFX_DIBitmap* pBitmap) const { - if (pBitmap && pBitmap != m_pCachedBitmap) { + if (pBitmap && pBitmap != m_pCachedBitmap.get()) { delete pBitmap; } } @@ -682,8 +682,7 @@ void CPDF_DIBSource::LoadJpxBitmap() { if (!pJpxModule) return; - nonstd::unique_ptr<JpxBitMapContext> context( - new JpxBitMapContext(pJpxModule)); + std::unique_ptr<JpxBitMapContext> context(new JpxBitMapContext(pJpxModule)); context->set_decoder(pJpxModule->CreateDecoder( m_pStreamAcc->GetData(), m_pStreamAcc->GetSize(), m_pColorSpace)); if (!context->decoder()) diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h index 6a63f61c06..5530754ab0 100644 --- a/core/src/fpdfapi/fpdf_render/render_int.h +++ b/core/src/fpdfapi/fpdf_render/render_int.h @@ -8,10 +8,10 @@ #define CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ #include <map> +#include <memory> #include "core/include/fpdfapi/fpdf_pageobj.h" #include "core/include/fpdfapi/fpdf_render.h" -#include "third_party/base/nonstd_unique_ptr.h" class CFX_GlyphBitmap; class CFX_ImageTransformer; @@ -254,7 +254,7 @@ class CPDF_RenderStatus { const CPDF_PageObject* m_pStopObj; CPDF_GraphicStates m_InitialStates; int m_HalftoneLimit; - nonstd::unique_ptr<IPDF_ObjectRenderer> m_pObjectRenderer; + std::unique_ptr<IPDF_ObjectRenderer> m_pObjectRenderer; FX_BOOL m_bPrint; int m_Transparency; int m_DitherBits; @@ -392,7 +392,7 @@ class CPDF_ScaledRenderBuffer { CPDF_RenderContext* m_pContext; FX_RECT m_Rect; const CPDF_PageObject* m_pObject; - nonstd::unique_ptr<CFX_FxgeDevice> m_pBitmapDevice; + std::unique_ptr<CFX_FxgeDevice> m_pBitmapDevice; CFX_Matrix m_Matrix; }; @@ -414,7 +414,7 @@ class CPDF_DeviceBuffer { CPDF_RenderContext* m_pContext; FX_RECT m_Rect; const CPDF_PageObject* m_pObject; - nonstd::unique_ptr<CFX_DIBitmap> m_pBitmap; + std::unique_ptr<CFX_DIBitmap> m_pBitmap; CFX_Matrix m_Matrix; }; @@ -589,7 +589,7 @@ class CPDF_DIBSource : public CFX_DIBSource { DIB_COMP_DATA* m_pCompData; uint8_t* m_pLineBuf; uint8_t* m_pMaskedLine; - nonstd::unique_ptr<CFX_DIBitmap> m_pCachedBitmap; + std::unique_ptr<CFX_DIBitmap> m_pCachedBitmap; ICodec_ScanlineDecoder* m_pDecoder; }; |