diff options
Diffstat (limited to 'core/fxge')
-rw-r--r-- | core/fxge/agg/fx_agg_driver.cpp | 21 | ||||
-rw-r--r-- | core/fxge/apple/fx_quartz_device.cpp | 5 | ||||
-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 | ||||
-rw-r--r-- | core/fxge/ge/cfx_font.cpp | 5 | ||||
-rw-r--r-- | core/fxge/ge/cfx_fontmgr.cpp | 3 | ||||
-rw-r--r-- | core/fxge/skia/fx_skia_device.cpp | 14 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_device.cpp | 3 |
9 files changed, 47 insertions, 40 deletions
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<CFX_ClipRgn> pClip; if (m_pClipRgn) - pClip = WrapUnique(new CFX_ClipRgn(*m_pClipRgn)); + pClip = pdfium::MakeUnique<CFX_ClipRgn>(*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<CFX_ClipRgn>(*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<CFX_ClipRgn>( + 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<CFX_ClipRgn>( + 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<CFX_AggDeviceDriver>( + 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<CFX_AggDeviceDriver>(pBitmap, FALSE, + pOriDevice, FALSE)); return true; } diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp index d3520d7257..74a03649dd 100644 --- a/core/fxge/apple/fx_quartz_device.cpp +++ b/core/fxge/apple/fx_quartz_device.cpp @@ -18,6 +18,7 @@ #include "core/fxge/dib/dib_int.h" #include "core/fxge/fx_freetype.h" #include "core/fxge/ge/fx_text_int.h" +#include "third_party/base/ptr_util.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ #include "core/fxge/apple/apple_int.h" @@ -1021,7 +1022,7 @@ FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, int32_t nDeviceClass) { m_pContext = context; CGContextRetain(m_pContext); SetDeviceDriver( - WrapUnique(new CFX_QuartzDeviceDriver(m_pContext, nDeviceClass))); + pdfium::MakeUnique<CFX_QuartzDeviceDriver>(m_pContext, nDeviceClass)); return TRUE; } @@ -1032,7 +1033,7 @@ FX_BOOL CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap) { return FALSE; SetDeviceDriver( - WrapUnique(new CFX_QuartzDeviceDriver(m_pContext, FXDC_DISPLAY))); + pdfium::MakeUnique<CFX_QuartzDeviceDriver>(m_pContext, FXDC_DISPLAY)); return TRUE; } 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; diff --git a/core/fxge/ge/cfx_font.cpp b/core/fxge/ge/cfx_font.cpp index 737d7c450b..e957b219f4 100644 --- a/core/fxge/ge/cfx_font.cpp +++ b/core/fxge/ge/cfx_font.cpp @@ -15,6 +15,7 @@ #include "core/fxge/cfx_substfont.h" #include "core/fxge/fx_freetype.h" #include "core/fxge/ge/fx_text_int.h" +#include "third_party/base/ptr_util.h" #define EM_ADJUST(em, a) (em == 0 ? (a) : (a)*1000 / em) @@ -244,7 +245,7 @@ FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) { m_bShallowCopy = true; if (pFont->m_pSubstFont) { - m_pSubstFont = WrapUnique(new CFX_SubstFont); + m_pSubstFont = pdfium::MakeUnique<CFX_SubstFont>(); m_pSubstFont->m_Charset = pFont->m_pSubstFont->m_Charset; m_pSubstFont->m_SubstFlags = pFont->m_pSubstFont->m_SubstFlags; m_pSubstFont->m_Weight = pFont->m_pSubstFont->m_Weight; @@ -319,7 +320,7 @@ void CFX_Font::LoadSubst(const CFX_ByteString& face_name, bool bVertical) { m_bEmbedded = false; m_bVertical = bVertical; - m_pSubstFont = WrapUnique(new CFX_SubstFont); + m_pSubstFont = pdfium::MakeUnique<CFX_SubstFont>(); m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont( face_name, bTrueType, flags, weight, italic_angle, CharsetCP, m_pSubstFont.get()); diff --git a/core/fxge/ge/cfx_fontmgr.cpp b/core/fxge/ge/cfx_fontmgr.cpp index 54000e6b5d..95a2b662ed 100644 --- a/core/fxge/ge/cfx_fontmgr.cpp +++ b/core/fxge/ge/cfx_fontmgr.cpp @@ -12,6 +12,7 @@ #include "core/fxge/fx_font.h" #include "core/fxge/ge/cttfontdesc.h" #include "core/fxge/ifx_systemfontinfo.h" +#include "third_party/base/ptr_util.h" namespace { @@ -81,7 +82,7 @@ int GetTTCIndex(const uint8_t* pFontData, CFX_FontMgr::CFX_FontMgr() : m_FTLibrary(nullptr), m_FTLibrarySupportsHinting(false) { - m_pBuiltinMapper = WrapUnique(new CFX_FontMapper(this)); + m_pBuiltinMapper = pdfium::MakeUnique<CFX_FontMapper>(this); } CFX_FontMgr::~CFX_FontMgr() { diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 6a492dd074..928b56fa61 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -20,7 +20,7 @@ #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/skia/fx_skia_device.h" - +#include "third_party/base/ptr_util.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColorFilter.h" #include "third_party/skia/include/core/SkColorPriv.h" @@ -1586,7 +1586,7 @@ void CFX_FxgeDevice::Clear(uint32_t color) { SkPictureRecorder* CFX_FxgeDevice::CreateRecorder(int size_x, int size_y) { CFX_SkiaDeviceDriver* skDriver = new CFX_SkiaDeviceDriver(size_x, size_y); - SetDeviceDriver(WrapUnique(skDriver)); + SetDeviceDriver(pdfium::WrapUnique(skDriver)); return skDriver->GetRecorder(); } @@ -1597,15 +1597,15 @@ bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, if (!pBitmap) return false; SetBitmap(pBitmap); - SetDeviceDriver(WrapUnique(new CFX_SkiaDeviceDriver( - pBitmap, bRgbByteOrder, pOriDevice, bGroupKnockout))); + SetDeviceDriver(pdfium::MakeUnique<CFX_SkiaDeviceDriver>( + pBitmap, bRgbByteOrder, pOriDevice, bGroupKnockout)); return true; } bool CFX_FxgeDevice::AttachRecorder(SkPictureRecorder* recorder) { if (!recorder) return false; - SetDeviceDriver(WrapUnique(new CFX_SkiaDeviceDriver(recorder))); + SetDeviceDriver(pdfium::MakeUnique<CFX_SkiaDeviceDriver>(recorder)); return true; } @@ -1620,8 +1620,8 @@ bool CFX_FxgeDevice::Create(int width, return false; } SetBitmap(pBitmap); - SetDeviceDriver( - WrapUnique(new CFX_SkiaDeviceDriver(pBitmap, FALSE, pOriDevice, FALSE))); + SetDeviceDriver(pdfium::MakeUnique<CFX_SkiaDeviceDriver>(pBitmap, FALSE, + pOriDevice, FALSE)); return true; } diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index f0eb2dbce2..bc6817da63 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -27,6 +27,7 @@ #include "core/fxge/win32/cfx_windowsdib.h" #include "core/fxge/win32/dwrite_int.h" #include "core/fxge/win32/win32_int.h" +#include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #ifndef _SKIA_SUPPORT_ @@ -1369,7 +1370,7 @@ FX_BOOL CGdiDisplayDriver::StartDIBits(const CFX_DIBSource* pBitmap, } CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC) { - SetDeviceDriver(WrapUnique(CreateDriver(hDC))); + SetDeviceDriver(pdfium::WrapUnique(CreateDriver(hDC))); } CFX_WindowsDevice::~CFX_WindowsDevice() {} |