diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-04-16 09:13:02 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-04-16 09:13:02 -0700 |
commit | 3f754d483e257f0d373be28a64b58620b4e0953f (patch) | |
tree | 51dbd10bcfc25572ab5a6a70eba2eab0f6bf3131 /core/src/fxge/win32 | |
parent | 026623249c78ba305c874cc093a035ef5a4cd1b4 (diff) | |
download | pdfium-3f754d483e257f0d373be28a64b58620b4e0953f.tar.xz |
Remove checks in fxge/{apple,win32,skia,dib} now that FX_NEW cant return 0
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1062863006
Diffstat (limited to 'core/src/fxge/win32')
-rw-r--r-- | core/src/fxge/win32/fx_win32_device.cpp | 26 | ||||
-rw-r--r-- | core/src/fxge/win32/fx_win32_dib.cpp | 22 | ||||
-rw-r--r-- | core/src/fxge/win32/fx_win32_dwrite.cpp | 13 | ||||
-rw-r--r-- | core/src/fxge/win32/fx_win32_gdipext.cpp | 10 | ||||
-rw-r--r-- | core/src/fxge/win32/fx_win32_print.cpp | 13 |
5 files changed, 18 insertions, 66 deletions
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index debf94d7a6..00baa2bee9 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -393,14 +393,11 @@ FX_BOOL CWin32FontInfo::GetFontCharset(void* hFont, int& charset) } IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() { - return FX_NEW CWin32FontInfo; + return new CWin32FontInfo; } void CFX_GEModule::InitPlatform() { - CWin32Platform* pPlatformData = FX_NEW CWin32Platform; - if (!pPlatformData) { - return; - } + CWin32Platform* pPlatformData = new CWin32Platform; OSVERSIONINFO ver; ver.dwOSVersionInfoSize = sizeof(ver); GetVersionEx(&ver); @@ -1143,10 +1140,7 @@ CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC, FX_BOOL bCmykOutput, FX_BOOL bForc m_bForcePSOutput = bForcePSOutput; m_psLevel = psLevel; if (bForcePSOutput) { - IFX_RenderDeviceDriver* pDriver = FX_NEW CPSPrinterDriver; - if (!pDriver) { - return; - } + IFX_RenderDeviceDriver* pDriver = new CPSPrinterDriver; ((CPSPrinterDriver*)pDriver)->Init(hDC, psLevel, bCmykOutput); SetDeviceDriver(pDriver); return; @@ -1172,9 +1166,9 @@ IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC, FX_BOOL bCmykOu device_class = FXDC_DISPLAY; } if (device_class == FXDC_PRINTER) { - return FX_NEW CGdiPrinterDriver(hDC); + return new CGdiPrinterDriver(hDC); } - return FX_NEW CGdiDisplayDriver(hDC); + return new CGdiDisplayDriver(hDC); } CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, int height, FXDIB_Format format) { @@ -1190,18 +1184,12 @@ CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, int height, FXDIB_Format for if (m_hBitmap == NULL) { return; } - CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; - if (!pBitmap) { - return; - } + CFX_DIBitmap* pBitmap = new CFX_DIBitmap; pBitmap->Create(width, height, format, pBuffer); SetBitmap(pBitmap); m_hDC = ::CreateCompatibleDC(NULL); m_hOldBitmap = (HBITMAP)SelectObject(m_hDC, m_hBitmap); - IFX_RenderDeviceDriver* pDriver = FX_NEW CGdiDisplayDriver(m_hDC); - if (!pDriver) { - return; - } + IFX_RenderDeviceDriver* pDriver = new CGdiDisplayDriver(m_hDC); SetDeviceDriver(pDriver); } CFX_WinBitmapDevice::~CFX_WinBitmapDevice() diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp index 2ecf539ff7..ec523c39c1 100644 --- a/core/src/fxge/win32/fx_win32_dib.cpp +++ b/core/src/fxge/win32/fx_win32_dib.cpp @@ -59,10 +59,7 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, FX_BOOL bBottomUp = FALSE; } int pitch = (width * pbmi->bmiHeader.biBitCount + 31) / 32 * 4; - CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; - if (!pBitmap) { - return NULL; - } + CFX_DIBitmap* pBitmap = new CFX_DIBitmap; FXDIB_Format format = bAlpha ? (FXDIB_Format)(pbmi->bmiHeader.biBitCount + 0x200) : (FXDIB_Format)pbmi->bmiHeader.biBitCount; FX_BOOL ret = pBitmap->Create(width, height, format); if (!ret) { @@ -135,11 +132,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(FX_LPCWSTR filename) HDC hDC = CreateCompatibleDC(NULL); int width, height; GetBitmapSize(hBitmap, width, height); - CFX_DIBitmap* pDIBitmap = FX_NEW CFX_DIBitmap; - if (!pDIBitmap) { - DeleteDC(hDC); - return NULL; - } + CFX_DIBitmap* pDIBitmap = new CFX_DIBitmap; if (!pDIBitmap->Create(width, height, FXDIB_Rgb)) { delete pDIBitmap; DeleteDC(hDC); @@ -171,11 +164,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) HDC hDC = CreateCompatibleDC(NULL); int width, height; GetBitmapSize(hBitmap, width, height); - CFX_DIBitmap* pDIBitmap = FX_NEW CFX_DIBitmap; - if (!pDIBitmap) { - DeleteDC(hDC); - return NULL; - } + CFX_DIBitmap* pDIBitmap = new CFX_DIBitmap; if (!pDIBitmap->Create(width, height, FXDIB_Rgb)) { delete pDIBitmap; DeleteDC(hDC); @@ -206,10 +195,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pP int height = abs(bmih.biHeight); bmih.biHeight = -height; bmih.biCompression = BI_RGB; - CFX_DIBitmap* pDIBitmap = FX_NEW CFX_DIBitmap; - if (!pDIBitmap) { - return NULL; - } + CFX_DIBitmap* pDIBitmap = new CFX_DIBitmap; int ret = 0; if (bmih.biBitCount == 1 || bmih.biBitCount == 8) { int size = sizeof (BITMAPINFOHEADER) + 8; diff --git a/core/src/fxge/win32/fx_win32_dwrite.cpp b/core/src/fxge/win32/fx_win32_dwrite.cpp index 1ad4f8c457..7a17c4ad09 100644 --- a/core/src/fxge/win32/fx_win32_dwrite.cpp +++ b/core/src/fxge/win32/fx_win32_dwrite.cpp @@ -57,8 +57,7 @@ public: static IDWriteFontFileLoader* GetLoader() { if (instance_ == NULL) { - instance_ = FX_NEW CDwFontFileLoader(); - return instance_; + instance_ = new CDwFontFileLoader(); } return instance_; } @@ -209,10 +208,7 @@ FX_BOOL CDWriteExt::DwCreateRenderingTarget(CFX_DIBitmap* pBitmap, void** render if (FAILED(hr)) { goto failed; } - *(CDwGdiTextRenderer**)renderTarget = FX_NEW CDwGdiTextRenderer(pBitmap, pBitmapRenderTarget, pRenderingParams); - if (*(CDwGdiTextRenderer**)renderTarget == NULL) { - goto failed; - } + *(CDwGdiTextRenderer**)renderTarget = new CDwGdiTextRenderer(pBitmap, pBitmapRenderTarget, pRenderingParams); SafeRelease(&pGdiInterop); SafeRelease(&pBitmapRenderTarget); SafeRelease(&pRenderingParams); @@ -372,10 +368,7 @@ HRESULT STDMETHODCALLTYPE CDwFontFileLoader::CreateStreamFromKey( ) { *fontFileStream = NULL; - CDwFontFileStream* stream = FX_NEW CDwFontFileStream(fontFileReferenceKey, fontFileReferenceKeySize); - if (stream == NULL) { - return E_OUTOFMEMORY; - } + CDwFontFileStream* stream = new CDwFontFileStream(fontFileReferenceKey, fontFileReferenceKeySize); if (!stream->IsInitialized()) { delete stream; return E_FAIL; diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp index e668b49200..fae1883f4d 100644 --- a/core/src/fxge/win32/fx_win32_gdipext.cpp +++ b/core/src/fxge/win32/fx_win32_gdipext.cpp @@ -302,10 +302,7 @@ static CFX_DIBitmap* _StretchMonoToGray(int dest_width, int dest_height, int result_width = pClipRect->Width(); int result_height = pClipRect->Height(); int result_pitch = (result_width + 3) / 4 * 4; - CFX_DIBitmap* pStretched = FX_NEW CFX_DIBitmap; - if (!pStretched) { - return NULL; - } + CFX_DIBitmap* pStretched = new CFX_DIBitmap; if (!pStretched->Create(result_width, result_height, FXDIB_8bppRgb)) { delete pStretched; return NULL; @@ -1164,10 +1161,7 @@ static PREVIEW3_DIBITMAP* LoadDIBitmap(WINDIB_Open_Args_ args) if (args.memory_size == 0 || !args.memory_base) { return NULL; } - pStream = FX_NEW GpStream; - if (!pStream) { - return NULL; - } + pStream = new GpStream; pStream->Write(args.memory_base, (ULONG)args.memory_size, NULL); status = CallFunc(GdipCreateBitmapFromStreamICM)(pStream, &pBitmap); } diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp index 9e7a0aae95..7dc48a1808 100644 --- a/core/src/fxge/win32/fx_win32_print.cpp +++ b/core/src/fxge/win32/fx_win32_print.cpp @@ -143,13 +143,7 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_Af CPDF_FixedMatrix result2src_fix(result2src, 8); int result_width = result_rect.Width(); int result_height = result_rect.Height(); - CFX_DIBitmap* pTempBitmap = FX_NEW CFX_DIBitmap; - if (!pTempBitmap) { - if (pSrcBitmap != src_bitmap) { - delete pSrcBitmap; - } - return NULL; - } + CFX_DIBitmap* pTempBitmap = new CFX_DIBitmap; if (!pTempBitmap->Create(result_width, result_height, pSrc->GetFormat())) { delete pTempBitmap; if (pSrcBitmap != src_bitmap) { @@ -291,10 +285,7 @@ FX_BOOL CPSPrinterDriver::Init(HDC hDC, int pslevel, FX_BOOL bCmykOutput) m_Width = ::GetDeviceCaps(m_hDC, HORZRES); m_Height = ::GetDeviceCaps(m_hDC, VERTRES); m_nBitsPerPixel = ::GetDeviceCaps(m_hDC, BITSPIXEL); - m_pPSOutput = FX_NEW CPSOutput(hDC); - if (!m_pPSOutput) { - return FALSE; - } + m_pPSOutput = new CPSOutput(hDC); ((CPSOutput*)m_pPSOutput)->Init(); m_PSRenderer.Init(m_pPSOutput, pslevel, m_Width, m_Height, bCmykOutput); m_bCmykOutput = bCmykOutput; |