Remove checks in fxge/{apple,win32,skia,dib} now that FX_NEW cant return 0
authorTom Sepez <tsepez@chromium.org>
Thu, 16 Apr 2015 16:13:02 +0000 (09:13 -0700)
committerTom Sepez <tsepez@chromium.org>
Thu, 16 Apr 2015 16:13:02 +0000 (09:13 -0700)
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1062863006

12 files changed:
core/src/fxge/apple/fx_mac_imp.cpp
core/src/fxge/apple/fx_quartz_device.cpp
core/src/fxge/dib/fx_dib_convert.cpp
core/src/fxge/dib/fx_dib_engine.cpp
core/src/fxge/dib/fx_dib_main.cpp
core/src/fxge/dib/fx_dib_transform.cpp
core/src/fxge/skia/fx_skia_device.cpp
core/src/fxge/win32/fx_win32_device.cpp
core/src/fxge/win32/fx_win32_dib.cpp
core/src/fxge/win32/fx_win32_dwrite.cpp
core/src/fxge/win32/fx_win32_gdipext.cpp
core/src/fxge/win32/fx_win32_print.cpp

index 5acedc0..75489ea 100644 (file)
@@ -87,10 +87,7 @@ void* CFX_MacFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pit
 }
 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault()
 {
-    CFX_MacFontInfo* pInfo = FX_NEW CFX_MacFontInfo;
-    if (!pInfo) {
-        return NULL;
-    }
+    CFX_MacFontInfo* pInfo = new CFX_MacFontInfo;
     pInfo->AddPath("~/Library/Fonts");
     pInfo->AddPath("/Library/Fonts");
     pInfo->AddPath("/System/Library/Fonts");
@@ -98,7 +95,7 @@ IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault()
 }
 void CFX_GEModule::InitPlatform()
 {
-    m_pPlatformData = FX_NEW CApplePlatform;
+    m_pPlatformData = new CApplePlatform;
     m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault());
 }
 void CFX_GEModule::DestroyPlatform()
index 050d874..f7faee1 100644 (file)
@@ -1097,10 +1097,7 @@ FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, FX_INT32 nDeviceClass)
     }
     m_pContext = context;
     CGContextRetain(m_pContext);
-    IFX_RenderDeviceDriver* pDriver = FX_NEW CFX_QuartzDeviceDriver(m_pContext, nDeviceClass);
-    if (!pDriver) {
-        return FALSE;
-    }
+    IFX_RenderDeviceDriver* pDriver = new CFX_QuartzDeviceDriver(m_pContext, nDeviceClass);
     SetDeviceDriver(pDriver);
     return TRUE;
 }
@@ -1111,10 +1108,7 @@ FX_BOOL CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap)
     if (NULL == m_pContext) {
         return FALSE;
     }
-    IFX_RenderDeviceDriver* pDriver = FX_NEW CFX_QuartzDeviceDriver(m_pContext, FXDC_DISPLAY);
-    if (!pDriver) {
-        return FALSE;
-    }
+    IFX_RenderDeviceDriver* pDriver = new CFX_QuartzDeviceDriver(m_pContext, FXDC_DISPLAY);
     SetDeviceDriver(pDriver);
     return TRUE;
 }
@@ -1123,10 +1117,7 @@ FX_BOOL CFX_QuartzDevice::Create(FX_INT32 width, FX_INT32 height, FXDIB_Format f
     if ((FX_BYTE)format < 32) {
         return FALSE;
     }
-    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;
index cfcbc70..7932305 100644 (file)
@@ -942,10 +942,7 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format, const FX_REC
         }
         return pClone;
     }
-    CFX_DIBitmap* pClone = FX_NEW CFX_DIBitmap;
-    if (!pClone) {
-        return NULL;
-    }
+    CFX_DIBitmap* pClone = new CFX_DIBitmap;
     if(!pClone->Create(m_Width, m_Height, dest_format)) {
         delete pClone;
         return NULL;
index f4c0ef1..997ca1d 100644 (file)
@@ -765,10 +765,7 @@ FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause)
 #define MAX_PROGRESSIVE_STRETCH_PIXELS 1000000
 FX_BOOL CFX_ImageStretcher::StartStretch()
 {
-    m_pStretchEngine = FX_NEW CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource, m_Flags);
-    if (!m_pStretchEngine) {
-        return FALSE;
-    }
+    m_pStretchEngine = new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource, m_Flags);
     m_pStretchEngine->StartStretchHorz();
     if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH_PIXELS) {
         m_pStretchEngine->Continue(NULL);
index 2cb41f6..59c0bd6 100644 (file)
@@ -164,10 +164,7 @@ CFX_DIBitmap* CFX_DIBSource::Clone(const FX_RECT* pClip) const
             return NULL;
         }
     }
-    CFX_DIBitmap* pNewBitmap = FX_NEW CFX_DIBitmap;
-    if (!pNewBitmap) {
-        return NULL;
-    }
+    CFX_DIBitmap* pNewBitmap = new CFX_DIBitmap;
     if (!pNewBitmap->Create(rect.Width(), rect.Height(), GetFormat())) {
         delete pNewBitmap;
         return NULL;
@@ -236,10 +233,7 @@ FX_BOOL CFX_DIBSource::BuildAlphaMask()
     if (m_pAlphaMask) {
         return TRUE;
     }
-    m_pAlphaMask = FX_NEW CFX_DIBitmap;
-    if (!m_pAlphaMask) {
-        return FALSE;
-    }
+    m_pAlphaMask = new CFX_DIBitmap;
     if (!m_pAlphaMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
         delete m_pAlphaMask;
         m_pAlphaMask = NULL;
@@ -574,10 +568,7 @@ CFX_DIBitmap* CFX_DIBSource::GetAlphaMask(const FX_RECT* pClip) const
             return NULL;
         }
     }
-    CFX_DIBitmap* pMask = FX_NEW CFX_DIBitmap;
-    if (!pMask) {
-        return NULL;
-    }
+    CFX_DIBitmap* pMask = new CFX_DIBitmap;
     if (!pMask->Create(rect.Width(), rect.Height(), FXDIB_8bppMask)) {
         delete pMask;
         return NULL;
@@ -902,10 +893,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform)
                     int b = (FX_BYTE)m_pPalette[i];
                     gray[i] = (FX_BYTE)FXRGB2GRAY(r, g, b);
                 }
-                CFX_DIBitmap* pMask = FX_NEW CFX_DIBitmap;
-                if (!pMask) {
-                    return FALSE;
-                }
+                CFX_DIBitmap* pMask = new CFX_DIBitmap;
                 if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
                     delete pMask;
                     return FALSE;
@@ -936,10 +924,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform)
                     int b = (FX_BYTE)m_pPalette[i];
                     gray[i] = (FX_BYTE)FXRGB2GRAY(r, g, b);
                 }
-                CFX_DIBitmap* pMask = FX_NEW CFX_DIBitmap;
-                if (!pMask) {
-                    return FALSE;
-                }
+                CFX_DIBitmap* pMask = new CFX_DIBitmap;
                 if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
                     delete pMask;
                     return FALSE;
@@ -956,10 +941,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform)
                 break;
             }
         case FXDIB_Rgb: {
-                CFX_DIBitmap* pMask = FX_NEW CFX_DIBitmap;
-                if (!pMask) {
-                    return FALSE;
-                }
+                CFX_DIBitmap* pMask = new CFX_DIBitmap;
                 if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
                     delete pMask;
                     return FALSE;
@@ -977,10 +959,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform)
                 break;
             }
         case FXDIB_Rgb32: {
-                CFX_DIBitmap* pMask = FX_NEW CFX_DIBitmap;
-                if (!pMask) {
-                    return FALSE;
-                }
+                CFX_DIBitmap* pMask = new CFX_DIBitmap;
                 if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
                     delete pMask;
                     return FALSE;
@@ -1414,10 +1393,7 @@ FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, int pal_size, const FX_
 }
 CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const
 {
-    CFX_DIBitmap* pFlipped = FX_NEW CFX_DIBitmap;
-    if (!pFlipped) {
-        return NULL;
-    }
+    CFX_DIBitmap* pFlipped = new CFX_DIBitmap;
     if (!pFlipped->Create(m_Width, m_Height, GetFormat())) {
         delete pFlipped;
         return NULL;
@@ -1491,10 +1467,7 @@ CFX_DIBExtractor::CFX_DIBExtractor(const CFX_DIBSource* pSrc)
     if (pSrc->GetBuffer() == NULL) {
         m_pBitmap = pSrc->Clone();
     } else {
-        m_pBitmap = FX_NEW CFX_DIBitmap;
-        if (!m_pBitmap) {
-            return;
-        }
+        m_pBitmap = new CFX_DIBitmap;
         if (!m_pBitmap->Create(pSrc->GetWidth(), pSrc->GetHeight(), pSrc->GetFormat(), pSrc->GetBuffer())) {
             delete m_pBitmap;
             m_pBitmap = NULL;
@@ -1605,10 +1578,7 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClip
             return TRUE;
         }
         m_Status = 2;
-        m_pTransformer = FX_NEW CFX_ImageTransformer;
-        if (!m_pTransformer) {
-            return FALSE;
-        }
+        m_pTransformer = new CFX_ImageTransformer;
         m_pTransformer->Start(pSource, &m_Matrix, dib_flags, &m_ClipBox);
         return TRUE;
     }
@@ -1707,10 +1677,7 @@ void CFX_BitmapStorer::ComposeScanline(int line, FX_LPCBYTE scanline, FX_LPCBYTE
 }
 FX_BOOL CFX_BitmapStorer::SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette)
 {
-    m_pBitmap = FX_NEW CFX_DIBitmap;
-    if (!m_pBitmap) {
-        return FALSE;
-    }
+    m_pBitmap = new CFX_DIBitmap;
     if (!m_pBitmap->Create(width, height, src_format)) {
         delete m_pBitmap;
         m_pBitmap = NULL;
index 65afdd6..457fe2e 100644 (file)
@@ -63,10 +63,7 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC
     if (dest_clip.IsEmpty()) {
         return NULL;
     }
-    CFX_DIBitmap* pTransBitmap = FX_NEW CFX_DIBitmap;
-    if (!pTransBitmap) {
-        return NULL;
-    }
+    CFX_DIBitmap* pTransBitmap = new CFX_DIBitmap;
     int result_height = dest_clip.Height(), result_width = dest_clip.Width();
     if (!pTransBitmap->Create(result_width, result_height, GetFormat())) {
         delete pTransBitmap;
@@ -369,10 +366,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause)
         stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer();
     }
     int stretch_pitch = m_Storer.GetBitmap()->GetPitch();
-    CFX_DIBitmap* pTransformed = FX_NEW CFX_DIBitmap;
-    if (!pTransformed) {
-        return FALSE;
-    }
+    CFX_DIBitmap* pTransformed = new CFX_DIBitmap;
     FXDIB_Format transformF = _GetTransformedFormat(m_Stretcher.m_pSource);
     if (!pTransformed->Create(m_ResultWidth, m_ResultHeight, transformF)) {
         delete pTransformed;
index 6c329ee..cc4059d 100644 (file)
@@ -237,7 +237,7 @@ static void SkRasterizeStroke(SkPaint& spaint, SkPath* dstPathData, SkPath& path
 
 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout)
 {
-       m_pAggDriver = FX_NEW CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout);
+       m_pAggDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout);
 }
 CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver()
 {
@@ -300,7 +300,7 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,       //
                                                )
 {
        if (m_pAggDriver->m_pClipRgn == NULL)
-               m_pAggDriver->m_pClipRgn = FX_NEW CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT));
+               m_pAggDriver->m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT));
 
        if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) {
                CFX_FloatRect rectf;
@@ -332,7 +332,7 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData,
                                        )
 {
        if (m_pAggDriver->m_pClipRgn == NULL)
-               m_pAggDriver->m_pClipRgn = FX_NEW CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT));
+               m_pAggDriver->m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT));
 
        // build path data
        CSkia_PathData path_data;
@@ -505,7 +505,7 @@ FX_BOOL CFX_SkiaDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL b
        if (pBitmap == NULL) 
                return FALSE;
        SetBitmap(pBitmap);
-       CFX_SkiaDeviceDriver* pDriver = FX_NEW CFX_SkiaDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout);
+       CFX_SkiaDeviceDriver* pDriver = new CFX_SkiaDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout);
        SetDeviceDriver(pDriver);
        return TRUE;
 }
@@ -513,13 +513,13 @@ FX_BOOL CFX_SkiaDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL b
 FX_BOOL CFX_SkiaDevice::Create(int width, int height, FXDIB_Format format, int dither_bits, CFX_DIBitmap* pOriDevice)
 {
        m_bOwnedBitmap = TRUE;
-       CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap;
+       CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
        if (!pBitmap->Create(width, height, format)) {
                delete pBitmap;
                return FALSE;
        } 
        SetBitmap(pBitmap);
-       CFX_SkiaDeviceDriver* pDriver =  FX_NEW CFX_SkiaDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE);
+       CFX_SkiaDeviceDriver* pDriver =  new CFX_SkiaDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE);
        SetDeviceDriver(pDriver);
        return TRUE;
 }
@@ -528,4 +528,4 @@ CFX_SkiaDevice::~CFX_SkiaDevice()
        if (m_bOwnedBitmap && GetBitmap()) delete GetBitmap();
 }
 
-#endif
\ No newline at end of file
+#endif
index debf94d..00baa2b 100644 (file)
@@ -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()
index 2ecf539..ec523c3 100644 (file)
@@ -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;
index 1ad4f8c..7a17c4a 100644 (file)
@@ -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;
index e668b49..fae1883 100644 (file)
@@ -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);
     }
index 9e7a0aa..7dc48a1 100644 (file)
@@ -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;