From aa8bf7e42b8c73a9bc07ed6781364ba05f5a9776 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 24 Dec 2015 19:13:32 -0800 Subject: 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 . --- core/src/fpdfapi/fpdf_render/fpdf_render.cpp | 12 ++++++------ core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp | 12 ++++++------ core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 9 ++++----- core/src/fpdfapi/fpdf_render/render_int.h | 10 +++++----- 4 files changed, 21 insertions(+), 22 deletions(-) (limited to 'core/src/fpdfapi/fpdf_render') 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 pTextClippingPath; + std::unique_ptr 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 oriDevice; + std::unique_ptr 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 pTextMask; + std::unique_ptr 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 pSMaskSource( + std::unique_ptr 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 pBackdrop(new CFX_DIBitmap); + std::unique_ptr 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 pFuncs[3]; + std::unique_ptr 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 pBackdrop( + std::unique_ptr 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 pBackdrop1(new CFX_DIBitmap); + std::unique_ptr 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 pStretched( + std::unique_ptr 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 pTransformed( + std::unique_ptr 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 pFunc; + std::unique_ptr 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 pMask(new CFX_DIBitmap); + std::unique_ptr 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 #include #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 context( - new JpxBitMapContext(pJpxModule)); + std::unique_ptr 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 +#include #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 m_pObjectRenderer; + std::unique_ptr 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 m_pBitmapDevice; + std::unique_ptr 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 m_pBitmap; + std::unique_ptr 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 m_pCachedBitmap; + std::unique_ptr m_pCachedBitmap; ICodec_ScanlineDecoder* m_pDecoder; }; -- cgit v1.2.3