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

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

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: rebase Created 5 years 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/dib/fx_dib_composite.cpp ('k') | core/src/fxge/dib/fx_dib_engine.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_convert.cpp
diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp
index 956ff7ccc4cc743440340cb8f834c610cc7d2743..fb8f77b024ec4327b6a3f83346d10b460e9adf78 100644
--- a/core/src/fxge/dib/fx_dib_convert.cpp
+++ b/core/src/fxge/dib/fx_dib_convert.cpp
@@ -209,7 +209,7 @@ CFX_Palette::~CFX_Palette() {
m_lut = 0;
}
FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) {
- if (pBitmap == NULL) {
+ if (!pBitmap) {
return FALSE;
}
FX_Free(m_pPalette);
@@ -560,7 +560,7 @@ inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform(
palette.BuildPalette(pSrcBitmap, FXDIB_PALETTE_LOC);
FX_DWORD* cLut = palette.GetColorLut();
FX_DWORD* aLut = palette.GetAmountLut();
- if (cLut == NULL || aLut == NULL) {
+ if (!cLut || !aLut) {
return FALSE;
}
int lut = palette.Getlut();
@@ -981,7 +981,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
}
case FXDIB_8bppRgb:
case FXDIB_8bppRgba: {
- if ((src_format & 0xff) == 8 && pSrcBitmap->GetPalette() == NULL) {
+ if ((src_format & 0xff) == 8 && !pSrcBitmap->GetPalette()) {
return ConvertBuffer(FXDIB_8bppMask, dest_buf, dest_pitch, width,
height, pSrcBitmap, src_left, src_top, d_pal,
pIccTransform);
@@ -1076,12 +1076,12 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format,
const FX_RECT* pClip,
void* pIccTransform) const {
- if (dest_format == GetFormat() && pIccTransform == NULL) {
+ if (dest_format == GetFormat() && !pIccTransform) {
return Clone(pClip);
}
if (pClip) {
CFX_DIBitmap* pClone = Clone(pClip);
- if (pClone == NULL) {
+ if (!pClone) {
return NULL;
}
if (!pClone->ConvertFormat(dest_format, pIccTransform)) {
@@ -1099,7 +1099,7 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format,
CFX_DIBitmap* pSrcAlpha = NULL;
if (HasAlpha()) {
pSrcAlpha = (GetFormat() == FXDIB_Argb) ? GetAlphaMask() : m_pAlphaMask;
- if (pSrcAlpha == NULL) {
+ if (!pSrcAlpha) {
delete pClone;
return NULL;
}
@@ -1138,16 +1138,16 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format,
FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format,
void* pIccTransform) {
FXDIB_Format src_format = GetFormat();
- if (dest_format == src_format && pIccTransform == NULL) {
+ if (dest_format == src_format && !pIccTransform) {
return TRUE;
}
if (dest_format == FXDIB_8bppMask && src_format == FXDIB_8bppRgb &&
- m_pPalette == NULL) {
+ !m_pPalette) {
m_AlphaFlag = 1;
return TRUE;
}
if (dest_format == FXDIB_Argb && src_format == FXDIB_Rgb32 &&
- pIccTransform == NULL) {
+ !pIccTransform) {
m_AlphaFlag = 2;
for (int row = 0; row < m_Height; row++) {
uint8_t* scanline = m_pBuffer + row * m_Pitch + 3;
@@ -1161,7 +1161,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format,
int dest_bpp = dest_format & 0xff;
int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4;
uint8_t* dest_buf = FX_TryAlloc(uint8_t, dest_pitch * m_Height + 4);
- if (dest_buf == NULL) {
+ if (!dest_buf) {
return FALSE;
}
CFX_DIBitmap* pAlphaMask = NULL;
@@ -1180,12 +1180,12 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format,
} else if (dest_format & 0x0200) {
if (src_format == FXDIB_Argb) {
pAlphaMask = GetAlphaMask();
- if (pAlphaMask == NULL) {
+ if (!pAlphaMask) {
FX_Free(dest_buf);
return FALSE;
}
} else {
- if (m_pAlphaMask == NULL) {
+ if (!m_pAlphaMask) {
if (!BuildAlphaMask()) {
FX_Free(dest_buf);
return FALSE;
« no previous file with comments | « core/src/fxge/dib/fx_dib_composite.cpp ('k') | core/src/fxge/dib/fx_dib_engine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698