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/dib | |
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/dib')
-rw-r--r-- | core/src/fxge/dib/fx_dib_convert.cpp | 5 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_engine.cpp | 5 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_main.cpp | 55 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_transform.cpp | 10 |
4 files changed, 15 insertions, 60 deletions
diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp index cfcbc707cd..7932305a4f 100644 --- a/core/src/fxge/dib/fx_dib_convert.cpp +++ b/core/src/fxge/dib/fx_dib_convert.cpp @@ -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; diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp index f4c0ef16be..997ca1d7b4 100644 --- a/core/src/fxge/dib/fx_dib_engine.cpp +++ b/core/src/fxge/dib/fx_dib_engine.cpp @@ -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); diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index 2cb41f62b7..59c0bd6749 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -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; diff --git a/core/src/fxge/dib/fx_dib_transform.cpp b/core/src/fxge/dib/fx_dib_transform.cpp index 65afdd6b3a..457fe2e1f1 100644 --- a/core/src/fxge/dib/fx_dib_transform.cpp +++ b/core/src/fxge/dib/fx_dib_transform.cpp @@ -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; |