From 36eb4bdcae719cf33c536ff72ac000482aed8382 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 3 Oct 2016 15:24:27 -0700 Subject: Add ptr_util.h from base until std::make_unique<> available Review-Url: https://codereview.chromium.org/2386273004 --- core/fxge/agg/fx_agg_driver.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'core/fxge/agg') diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 4f9c85c8a9..d3be763def 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -27,6 +27,7 @@ #include "third_party/agg23/agg_rasterizer_scanline_aa.h" #include "third_party/agg23/agg_renderer_scanline.h" #include "third_party/agg23/agg_scanline_u.h" +#include "third_party/base/ptr_util.h" namespace { @@ -498,7 +499,7 @@ int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) const { void CFX_AggDeviceDriver::SaveState() { std::unique_ptr pClip; if (m_pClipRgn) - pClip = WrapUnique(new CFX_ClipRgn(*m_pClipRgn)); + pClip = pdfium::MakeUnique(*m_pClipRgn); m_StateStack.push_back(std::move(pClip)); } @@ -510,7 +511,7 @@ void CFX_AggDeviceDriver::RestoreState(bool bKeepSaved) { if (bKeepSaved) { if (m_StateStack.back()) - m_pClipRgn = WrapUnique(new CFX_ClipRgn(*m_StateStack.back())); + m_pClipRgn = pdfium::MakeUnique(*m_StateStack.back()); } else { m_pClipRgn = std::move(m_StateStack.back()); m_StateStack.pop_back(); @@ -544,8 +545,8 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, int fill_mode) { m_FillFlags = fill_mode; if (!m_pClipRgn) { - m_pClipRgn = WrapUnique(new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), - GetDeviceCaps(FXDC_PIXEL_HEIGHT))); + m_pClipRgn = pdfium::MakeUnique( + GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); } if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { CFX_FloatRect rectf; @@ -577,8 +578,8 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke( const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState) { if (!m_pClipRgn) { - m_pClipRgn = WrapUnique(new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), - GetDeviceCaps(FXDC_PIXEL_HEIGHT))); + m_pClipRgn = pdfium::MakeUnique( + GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); } CAgg_PathData path_data; path_data.BuildPath(pPathData, nullptr); @@ -1735,8 +1736,8 @@ bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, return false; SetBitmap(pBitmap); - SetDeviceDriver(WrapUnique(new CFX_AggDeviceDriver( - pBitmap, bRgbByteOrder, pOriDevice, bGroupKnockout))); + SetDeviceDriver(pdfium::MakeUnique( + pBitmap, bRgbByteOrder, pOriDevice, bGroupKnockout)); return true; } @@ -1751,8 +1752,8 @@ bool CFX_FxgeDevice::Create(int width, return false; } SetBitmap(pBitmap); - SetDeviceDriver( - WrapUnique(new CFX_AggDeviceDriver(pBitmap, FALSE, pOriDevice, FALSE))); + SetDeviceDriver(pdfium::MakeUnique(pBitmap, FALSE, + pOriDevice, FALSE)); return true; } -- cgit v1.2.3