diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-04-17 15:15:08 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-04-17 15:15:08 -0700 |
commit | 4cb07c9c9cd5761ce3179d3d7254c1cf0efeafa5 (patch) | |
tree | 2549011fbc3d9d6b8415394a5dc6372a2b346b1e /core/src/fxge | |
parent | 48606843d54c5f870d69627afedd574b58d65b3e (diff) | |
download | pdfium-4cb07c9c9cd5761ce3179d3d7254c1cf0efeafa5.tar.xz |
Fix all remaining instances of FX_NEW.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1084613006
Diffstat (limited to 'core/src/fxge')
-rw-r--r-- | core/src/fxge/agg/agg23/fx_agg_driver.cpp | 39 | ||||
-rw-r--r-- | core/src/fxge/android/fpf_skiafontmgr.cpp | 19 | ||||
-rw-r--r-- | core/src/fxge/android/fpf_skiamodule.cpp | 7 | ||||
-rw-r--r-- | core/src/fxge/android/fx_android_imp.cpp | 5 |
4 files changed, 18 insertions, 52 deletions
diff --git a/core/src/fxge/agg/agg23/fx_agg_driver.cpp b/core/src/fxge/agg/agg23/fx_agg_driver.cpp index 5944332fd8..08f76bf8e1 100644 --- a/core/src/fxge/agg/agg23/fx_agg_driver.cpp +++ b/core/src/fxge/agg/agg23/fx_agg_driver.cpp @@ -187,7 +187,7 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, agg::path_s } IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver(CFX_DIBitmap* pBitmap, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) { - return FX_NEW CFX_AggDeviceDriver(pBitmap, 0, bRgbByteOrder, pOriDevice, bGroupKnockout); + return new CFX_AggDeviceDriver(pBitmap, 0, bRgbByteOrder, pOriDevice, bGroupKnockout); } CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) { @@ -267,10 +267,7 @@ void CFX_AggDeviceDriver::SaveState() { void* pClip = NULL; if (m_pClipRgn) { - pClip = FX_NEW CFX_ClipRgn(*m_pClipRgn); - if (!pClip) { - return; - } + pClip = new CFX_ClipRgn(*m_pClipRgn); } m_StateStack.Add(pClip); } @@ -290,7 +287,7 @@ void CFX_AggDeviceDriver::RestoreState(FX_BOOL bKeepSaved) } if (bKeepSaved) { if (pSavedClip) { - m_pClipRgn = FX_NEW CFX_ClipRgn(*pSavedClip); + m_pClipRgn = new CFX_ClipRgn(*pSavedClip); } } else { m_StateStack.RemoveAt(m_StateStack.GetSize() - 1); @@ -325,10 +322,7 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, { m_FillFlags = fill_mode; if (m_pClipRgn == NULL) { - m_pClipRgn = FX_NEW CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); - if (!m_pClipRgn) { - return FALSE; - } + m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); } if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { CFX_FloatRect rectf; @@ -355,10 +349,7 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, ) { if (m_pClipRgn == NULL) { - m_pClipRgn = FX_NEW CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); - if (!m_pClipRgn) { - return FALSE; - } + m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); } CAgg_PathData path_data; path_data.BuildPath(pPathData, NULL); @@ -1565,10 +1556,7 @@ FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitma if (m_pBitmap->GetBuffer() == NULL) { return TRUE; } - CFX_ImageRenderer* pRenderer = FX_NEW CFX_ImageRenderer; - if (!pRenderer) { - return FALSE; - } + CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer; pRenderer->Start(m_pBitmap, m_pClipRgn, pSource, bitmap_alpha, argb, pMatrix, render_flags, m_bRgbByteOrder, alpha_flag, pIccTransform); handle = pRenderer; return TRUE; @@ -1597,29 +1585,20 @@ FX_BOOL CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL b return FALSE; } SetBitmap(pBitmap); - IFX_RenderDeviceDriver* pDriver = FX_NEW CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout); - if (!pDriver) { - return FALSE; - } + IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout); SetDeviceDriver(pDriver); return TRUE; } FX_BOOL CFX_FxgeDevice::Create(int width, int height, FXDIB_Format format, int dither_bits, CFX_DIBitmap* pOriDevice) { m_bOwnedBitmap = TRUE; - CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; - if (!pBitmap) { - return FALSE; - } + CFX_DIBitmap* pBitmap = new CFX_DIBitmap; if (!pBitmap->Create(width, height, format)) { delete pBitmap; return FALSE; } SetBitmap(pBitmap); - IFX_RenderDeviceDriver* pDriver = FX_NEW CFX_AggDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE); - if (!pDriver) { - return FALSE; - } + IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE); SetDeviceDriver(pDriver); return TRUE; } diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index a9bef8a2b8..fc012ea9ac 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -352,16 +352,12 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, FX_BYTE uCharset, } if (nItem > -1) { CFPF_SkiaFontDescriptor *pFontDes = (CFPF_SkiaFontDescriptor*)m_FontFaces.ElementAt(nItem); - CFPF_SkiaFont *pFont = FX_NEW CFPF_SkiaFont; - if (pFont) { - if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) { - m_FamilyFonts.SetAt((void*)(FX_UINTPTR)dwHash, (void*)pFont); - return pFont->Retain(); - } - pFont->Release(); - pFont = NULL; + CFPF_SkiaFont *pFont = new CFPF_SkiaFont; + if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) { + m_FamilyFonts.SetAt((void*)(FX_UINTPTR)dwHash, (void*)pFont); + return pFont->Retain(); } - return pFont; + pFont->Release(); } return NULL; } @@ -464,10 +460,7 @@ void CFPF_SkiaFontMgr::ScanFile(FX_BSTR file) { FXFT_Face face = GetFontFace(file); if (face) { - CFPF_SkiaPathFont *pFontDesc = FX_NEW CFPF_SkiaPathFont; - if (!pFontDesc) { - return; - } + CFPF_SkiaPathFont *pFontDesc = new CFPF_SkiaPathFont; pFontDesc->SetPath(file.GetCStr()); ReportFace(face, pFontDesc); m_FontFaces.Add(pFontDesc); diff --git a/core/src/fxge/android/fpf_skiamodule.cpp b/core/src/fxge/android/fpf_skiamodule.cpp index 94e68885fc..6b5987d1b7 100644 --- a/core/src/fxge/android/fpf_skiamodule.cpp +++ b/core/src/fxge/android/fpf_skiamodule.cpp @@ -12,7 +12,7 @@ static IFPF_DeviceModule *gs_pPFModule = NULL; IFPF_DeviceModule* FPF_GetDeviceModule() { if (!gs_pPFModule) { - gs_pPFModule = FX_NEW CFPF_SkiaDeviceModule; + gs_pPFModule = new CFPF_SkiaDeviceModule; } return gs_pPFModule; } @@ -32,10 +32,7 @@ void CFPF_SkiaDeviceModule::Destroy() IFPF_FontMgr* CFPF_SkiaDeviceModule::GetFontMgr() { if (!m_pFontMgr) { - m_pFontMgr = FX_NEW CFPF_SkiaFontMgr; - if (!m_pFontMgr) { - return NULL; - } + m_pFontMgr = new CFPF_SkiaFontMgr; if (!m_pFontMgr->InitFTLibrary()) { delete m_pFontMgr; return NULL; diff --git a/core/src/fxge/android/fx_android_imp.cpp b/core/src/fxge/android/fx_android_imp.cpp index 528877ef89..a1631ab8f0 100644 --- a/core/src/fxge/android/fx_android_imp.cpp +++ b/core/src/fxge/android/fx_android_imp.cpp @@ -14,10 +14,7 @@ void CFX_GEModule::InitPlatform() } IFPF_FontMgr *pFontMgr = pDeviceModule->GetFontMgr(); if (pFontMgr) { - CFX_AndroidFontInfo *pFontInfo = FX_NEW CFX_AndroidFontInfo; - if (!pFontInfo) { - return; - } + CFX_AndroidFontInfo *pFontInfo = new CFX_AndroidFontInfo; pFontInfo->Init(pFontMgr); m_pFontMgr->SetSystemFontInfo(pFontInfo); } |