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

Unified Diff: core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: self review 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
Index: core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 88bd22823d0565fda88a211cbaf8044408740490..8427386e812c7469f5630d1b08650ca4c01a22cf 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -169,11 +169,11 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize,
} else {
}
}
- if (pResBitmap == NULL) {
+ if (!pResBitmap) {
image_matrix.Scale(retinaScaleX, retinaScaleY);
pResBitmap = pBitmap->TransformTo(&image_matrix, left, top);
}
- if (pResBitmap == NULL) {
+ if (!pResBitmap) {
return NULL;
}
CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap;
@@ -218,7 +218,7 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj,
break;
case 1:
case 5:
- if (pFont->GetFace() == NULL &&
+ if (!pFont->GetFace() &&
!(pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_GLYPHPATH)) {
bFill = TRUE;
} else {
@@ -227,7 +227,7 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj,
break;
case 2:
case 6:
- if (pFont->GetFace() == NULL &&
+ if (!pFont->GetFace() &&
!(pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_GLYPHPATH)) {
bFill = TRUE;
} else {
@@ -305,21 +305,21 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj,
pFont, font_size, &text_matrix, fill_argb, &m_Options);
}
CPDF_Type3Cache* CPDF_RenderStatus::GetCachedType3(CPDF_Type3Font* pFont) {
- if (pFont->m_pDocument == NULL) {
+ if (!pFont->m_pDocument) {
return NULL;
}
pFont->m_pDocument->GetPageData()->GetFont(pFont->GetFontDict(), FALSE);
return pFont->m_pDocument->GetRenderData()->GetCachedType3(pFont);
}
static void ReleaseCachedType3(CPDF_Type3Font* pFont) {
- if (pFont->m_pDocument == NULL) {
+ if (!pFont->m_pDocument) {
return;
}
pFont->m_pDocument->GetRenderData()->ReleaseCachedType3(pFont);
pFont->m_pDocument->GetPageData()->ReleaseFont(pFont->GetFontDict());
}
FX_BOOL CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext) {
- if (m_pBitmap || m_pForm == NULL) {
+ if (m_pBitmap || !m_pForm) {
return TRUE;
}
if (m_pForm->CountObjects() == 1 && !m_bColored) {
@@ -390,7 +390,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(
continue;
}
CPDF_Type3Char* pType3Char = pType3Font->LoadChar(charcode);
- if (pType3Char == NULL) {
+ if (!pType3Char) {
continue;
}
CFX_AffineMatrix matrix = char_matrix;
@@ -401,7 +401,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(
if (pGlyphAndPos) {
for (int i = 0; i < iChar; i++) {
FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[i];
- if (glyph.m_pGlyph == NULL) {
+ if (!glyph.m_pGlyph) {
continue;
}
m_pDevice->SetBitMask(&glyph.m_pGlyph->m_Bitmap,
@@ -459,7 +459,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(
CPDF_Type3Cache* pCache = GetCachedType3(pType3Font);
refTypeCache.m_dwCount++;
CFX_GlyphBitmap* pBitmap = pCache->LoadGlyph(charcode, &matrix, sa, sd);
- if (pBitmap == NULL) {
+ if (!pBitmap) {
continue;
}
int origin_x = FXSYS_round(matrix.e);
@@ -498,7 +498,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(
bitmap.Clear(0);
for (int iChar = 0; iChar < textobj->m_nChars; iChar++) {
FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[iChar];
- if (glyph.m_pGlyph == NULL) {
+ if (!glyph.m_pGlyph) {
continue;
}
bitmap.TransferBitmap(
@@ -564,7 +564,7 @@ void CPDF_CharPosList::Load(int nChars,
charpos.m_OriginX = iChar ? pCharPos[iChar - 1] : 0;
charpos.m_OriginY = 0;
charpos.m_bGlyphAdjust = FALSE;
- if (pCIDFont == NULL) {
+ if (!pCIDFont) {
continue;
}
FX_WORD CID = pCIDFont->CIDFromCharCode(CharCode);
@@ -770,7 +770,7 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(
FXTEXT_CHARPOS& charpos = CharPosList.m_pCharPos[i];
const CFX_PathData* pPath = pFaceCache->LoadGlyphPath(
&pFont->m_Font, charpos.m_GlyphIndex, charpos.m_FontCharWidth);
- if (pPath == NULL) {
+ if (!pPath) {
continue;
}
CPDF_PathObject path;

Powered by Google App Engine
This is Rietveld 408576698