diff options
author | tsepez <tsepez@chromium.org> | 2016-10-03 15:24:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-03 15:24:27 -0700 |
commit | 36eb4bdcae719cf33c536ff72ac000482aed8382 (patch) | |
tree | b3c3467fa10eafc3863a619ef511d1bf20af6367 /core/fxge/dib | |
parent | 76383db4906c9357292846ace77566b34eb47de9 (diff) | |
download | pdfium-36eb4bdcae719cf33c536ff72ac000482aed8382.tar.xz |
Add ptr_util.h from base until std::make_unique<> available
Review-Url: https://codereview.chromium.org/2386273004
Diffstat (limited to 'core/fxge/dib')
-rw-r--r-- | core/fxge/dib/fx_dib_engine.cpp | 7 | ||||
-rw-r--r-- | core/fxge/dib/fx_dib_main.cpp | 15 | ||||
-rw-r--r-- | core/fxge/dib/fx_dib_transform.cpp | 14 |
3 files changed, 19 insertions, 17 deletions
diff --git a/core/fxge/dib/fx_dib_engine.cpp b/core/fxge/dib/fx_dib_engine.cpp index c8e9558888..389cf23909 100644 --- a/core/fxge/dib/fx_dib_engine.cpp +++ b/core/fxge/dib/fx_dib_engine.cpp @@ -10,6 +10,7 @@ #include "core/fxge/dib/dib_int.h" #include "core/fxge/fx_dib.h" +#include "third_party/base/ptr_util.h" namespace { @@ -930,9 +931,9 @@ FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) { } FX_BOOL CFX_ImageStretcher::StartStretch() { - m_pStretchEngine = WrapUnique( - new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, - m_ClipRect, m_pSource, m_Flags)); + m_pStretchEngine = pdfium::MakeUnique<CStretchEngine>( + m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource, + m_Flags); m_pStretchEngine->StartStretchHorz(); if (SourceSizeWithinLimit(m_pSource->GetWidth(), m_pSource->GetHeight())) { m_pStretchEngine->Continue(nullptr); diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp index 14cd0f4da6..df448a66bd 100644 --- a/core/fxge/dib/fx_dib_main.cpp +++ b/core/fxge/dib/fx_dib_main.cpp @@ -13,6 +13,7 @@ #include "core/fxge/cfx_gemodule.h" #include "core/fxge/dib/dib_int.h" #include "core/fxge/ge/cfx_cliprgn.h" +#include "third_party/base/ptr_util.h" void CmykDecode(uint32_t cmyk, int& c, int& m, int& y, int& k) { c = FXSYS_GetCValue(cmyk); @@ -1461,7 +1462,7 @@ CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const { CFX_DIBExtractor::CFX_DIBExtractor(const CFX_DIBSource* pSrc) { if (pSrc->GetBuffer()) { - m_pBitmap = WrapUnique(new CFX_DIBitmap); + m_pBitmap = pdfium::MakeUnique<CFX_DIBitmap>(); if (!m_pBitmap->Create(pSrc->GetWidth(), pSrc->GetHeight(), pSrc->GetFormat(), pSrc->GetBuffer())) { m_pBitmap.reset(); @@ -1567,9 +1568,9 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox, TRUE, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder, alpha_flag, pIccTransform, m_BlendType); - m_Stretcher = WrapUnique(new CFX_ImageStretcher(&m_Composer, pSource, - dest_height, dest_width, - bitmap_clip, dib_flags)); + m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>( + &m_Composer, pSource, dest_height, dest_width, bitmap_clip, + dib_flags); if (!m_Stretcher->Start()) return FALSE; @@ -1600,8 +1601,8 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, FALSE, FALSE, FALSE, m_bRgbByteOrder, alpha_flag, pIccTransform, m_BlendType); m_Status = 1; - m_Stretcher = WrapUnique(new CFX_ImageStretcher( - &m_Composer, pSource, dest_width, dest_height, bitmap_clip, dib_flags)); + m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>( + &m_Composer, pSource, dest_width, dest_height, bitmap_clip, dib_flags); return m_Stretcher->Start(); } @@ -1680,7 +1681,7 @@ FX_BOOL CFX_BitmapStorer::SetInfo(int width, int height, FXDIB_Format src_format, uint32_t* pSrcPalette) { - m_pBitmap = WrapUnique(new CFX_DIBitmap); + m_pBitmap = pdfium::MakeUnique<CFX_DIBitmap>(); if (!m_pBitmap->Create(width, height, src_format)) { m_pBitmap.reset(); return FALSE; diff --git a/core/fxge/dib/fx_dib_transform.cpp b/core/fxge/dib/fx_dib_transform.cpp index a559fee55d..559c6e2a38 100644 --- a/core/fxge/dib/fx_dib_transform.cpp +++ b/core/fxge/dib/fx_dib_transform.cpp @@ -7,6 +7,7 @@ #include "core/fxge/dib/dib_int.h" #include "core/fxge/fx_dib.h" +#include "third_party/base/ptr_util.h" namespace { @@ -363,8 +364,8 @@ FX_BOOL CFX_ImageTransformer::Start() { result_clip.Offset(-result_rect.left, -result_rect.top); result_clip = FXDIB_SwapClipBox(result_clip, dest_width, dest_height, m_pMatrix->c > 0, m_pMatrix->b < 0); - m_Stretcher = WrapUnique(new CFX_ImageStretcher( - &m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags)); + m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>( + &m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags); m_Stretcher->Start(); m_Status = 1; return TRUE; @@ -376,8 +377,8 @@ FX_BOOL CFX_ImageTransformer::Start() { int dest_height = m_pMatrix->d > 0 ? (int)-FXSYS_ceil(m_pMatrix->d) : (int)-FXSYS_floor(m_pMatrix->d); result_clip.Offset(-result_rect.left, -result_rect.top); - m_Stretcher = WrapUnique(new CFX_ImageStretcher( - &m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags)); + m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>( + &m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags); m_Stretcher->Start(); m_Status = 2; return TRUE; @@ -395,9 +396,8 @@ FX_BOOL CFX_ImageTransformer::Start() { clip_rect_f.Transform(&m_dest2stretch); m_StretchClip = clip_rect_f.GetOuterRect(); m_StretchClip.Intersect(0, 0, stretch_width, stretch_height); - m_Stretcher = WrapUnique(new CFX_ImageStretcher(&m_Storer, m_pSrc, - stretch_width, stretch_height, - m_StretchClip, m_Flags)); + m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>( + &m_Storer, m_pSrc, stretch_width, stretch_height, m_StretchClip, m_Flags); m_Stretcher->Start(); m_Status = 3; return TRUE; |