Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(766)

Unified Diff: core/src/fxge/dib/fx_dib_composite.cpp

Issue 1142713005: Remove FX_Alloc() null checks now that it can't return NULL. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix missing FX_Alloc2D, check overflow on add, remove unused enum. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxge/agg/agg23/fx_agg_rasterizer_scanline_aa.cpp ('k') | core/src/fxge/dib/fx_dib_convert.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxge/dib/fx_dib_composite.cpp
diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp
index ae72fc5a43969908d552a936efa4d268426cf5e1..e385bc9ffeff3e0d665406e23c1fcbbcfd98c10b 100644
--- a/core/src/fxge/dib/fx_dib_composite.cpp
+++ b/core/src/fxge/dib/fx_dib_composite.cpp
@@ -3601,9 +3601,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB
if ((dest_format & 0xff) == 8) {
int pal_count = 1 << (src_format & 0xff);
FX_LPBYTE gray_pal = FX_Alloc(FX_BYTE, pal_count);
- if (!gray_pal) {
- return;
- }
pDestPalette = (FX_DWORD*)gray_pal;
for (int i = 0; i < pal_count; i ++) {
FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) : FXARGB_TODIB(pSrcPalette[i]);
@@ -3613,9 +3610,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB
} else {
int palsize = 1 << (src_format & 0xff);
pDestPalette = FX_Alloc(FX_DWORD, palsize);
- if (!pDestPalette) {
- return;
- }
for (int i = 0; i < palsize; i ++) {
FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) : FXARGB_TODIB(pSrcPalette[i]);
pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&color, (FX_LPCBYTE)&color, 1);
@@ -3625,9 +3619,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB
} else {
int pal_count = 1 << (src_format & 0xff);
FX_LPBYTE gray_pal = FX_Alloc(FX_BYTE, pal_count);
- if (!gray_pal) {
- return;
- }
if (pal_count == 2) {
gray_pal[0] = 0;
gray_pal[1] = 255;
@@ -3641,10 +3632,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB
pDestPalette = (FX_DWORD*)gray_pal;
} else {
pDestPalette = FX_Alloc(FX_DWORD, pal_count);
- if (!pDestPalette) {
- FX_Free(gray_pal);
- return;
- }
for (int i = 0; i < pal_count; i ++) {
pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&pDestPalette[i], &gray_pal[i], 1);
pDestPalette[i] = isDstCmyk ? FXCMYK_TODIB(pDestPalette[i]) : FXARGB_TODIB(pDestPalette[i]);
@@ -3657,9 +3644,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB
if ((dest_format & 0xff) == 8) {
int pal_count = 1 << (src_format & 0xff);
FX_LPBYTE gray_pal = FX_Alloc(FX_BYTE, pal_count);
- if (!gray_pal) {
- return;
- }
pDestPalette = (FX_DWORD*)gray_pal;
if (isSrcCmyk) {
for (int i = 0; i < pal_count; i ++) {
@@ -3677,9 +3661,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB
} else {
int palsize = 1 << (src_format & 0xff);
pDestPalette = FX_Alloc(FX_DWORD, palsize);
- if (!pDestPalette) {
- return;
- }
if (isDstCmyk == isSrcCmyk) {
FXSYS_memcpy32(pDestPalette, pSrcPalette, palsize * sizeof(FX_DWORD));
} else {
@@ -3696,9 +3677,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB
if ((dest_format & 0xff) == 8) {
int pal_count = 1 << (src_format & 0xff);
FX_LPBYTE gray_pal = FX_Alloc(FX_BYTE, pal_count);
- if (!gray_pal) {
- return;
- }
if (pal_count == 2) {
gray_pal[0] = 0;
gray_pal[1] = 255;
@@ -3711,9 +3689,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB
} else {
int palsize = 1 << (src_format & 0xff);
pDestPalette = FX_Alloc(FX_DWORD, palsize);
- if (!pDestPalette) {
- return;
- }
if (palsize == 2) {
pDestPalette[0] = isSrcCmyk ? 255 : 0xff000000;
pDestPalette[1] = isSrcCmyk ? 0 : 0xffffffff;
@@ -4463,25 +4438,13 @@ FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_form
}
if (m_bVertical) {
m_pScanlineV = FX_Alloc(FX_BYTE, m_pBitmap->GetBPP() / 8 * width + 4);
- if (!m_pScanlineV) {
- return FALSE;
- }
m_pClipScanV = FX_Alloc(FX_BYTE, m_pBitmap->GetHeight());
- if (!m_pClipScanV) {
- return FALSE;
- }
if (m_pBitmap->m_pAlphaMask) {
m_pScanlineAlphaV = FX_Alloc(FX_BYTE, width + 4);
- if (!m_pScanlineAlphaV) {
- return FALSE;
- }
}
}
if (m_BitmapAlpha < 255) {
m_pAddClipScan = FX_Alloc(FX_BYTE, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth());
- if (!m_pAddClipScan) {
- return FALSE;
- }
}
return TRUE;
}
« no previous file with comments | « core/src/fxge/agg/agg23/fx_agg_rasterizer_scanline_aa.cpp ('k') | core/src/fxge/dib/fx_dib_convert.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698