diff options
author | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:34:00 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:34:00 -0800 |
commit | 412e908082a361d0fd9591eab939e96a882212f1 (patch) | |
tree | 11726052ae08f13dc5a05a82cbce870758580aeb /core/src/fpdfapi/fpdf_render | |
parent | 96660d6f382204339d6b1aadc3913303d436e252 (diff) | |
download | pdfium-412e908082a361d0fd9591eab939e96a882212f1.tar.xz |
Merge to XFA: Get rid of most instance of 'foo == NULL'
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1520063002 .
(cherry picked from commit e385244f8cd6ae376f6b3cf1265a0795d5d30eff)
Review URL: https://codereview.chromium.org/1528763003 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_render')
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render.cpp | 14 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp | 8 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp | 22 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 24 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 12 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp | 26 |
6 files changed, 53 insertions, 53 deletions
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index 801f9e737c..bee188e049 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -258,7 +258,7 @@ void CPDF_RenderStatus::RenderObjectList(const CPDF_PageObjects* pObjs, if (!pCurObj) { continue; } - if (pCurObj == NULL || pCurObj->m_Left > clip_rect.right || + if (!pCurObj || pCurObj->m_Left > clip_rect.right || pCurObj->m_Right < clip_rect.left || pCurObj->m_Bottom > clip_rect.top || pCurObj->m_Top < clip_rect.bottom) { @@ -358,7 +358,7 @@ FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, void CPDF_RenderStatus::DitherObjectArea(const CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device) { CFX_DIBitmap* pBitmap = m_pDevice->GetBitmap(); - if (pBitmap == NULL) { + if (!pBitmap) { return; } FX_RECT rect; @@ -684,7 +684,7 @@ void CPDF_RenderStatus::DrawClipPath(CPDF_ClipPath ClipPath, int i; for (i = 0; i < nClipPath; i++) { const CFX_PathData* pPathData = ClipPath.GetPath(i); - if (pPathData == NULL) { + if (!pPathData) { continue; } CFX_GraphStateData stroke_state; @@ -780,8 +780,8 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, pDocument->GetPageData()->ReleaseColorSpace(pCSObj); } } - if (pSMaskDict == NULL && group_alpha == 1.0f && - blend_type == FXDIB_BLEND_NORMAL && !bTextClip && !bGroupTransparent) { + if (!pSMaskDict && group_alpha == 1.0f && blend_type == FXDIB_BLEND_NORMAL && + !bTextClip && !bGroupTransparent) { return FALSE; } FX_BOOL isolated = Transparency & PDFTRANS_ISOLATED; @@ -838,7 +838,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, text_device.Attach(pTextMask.get()); for (FX_DWORD i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) { CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i); - if (textobj == NULL) { + if (!textobj) { break; } CFX_Matrix text_matrix; @@ -1079,7 +1079,7 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { for (; m_LayerIndex < nLayers; m_LayerIndex++) { _PDF_RenderItem* pItem = m_pContext->m_ContentList.GetDataPtr(m_LayerIndex); FX_POSITION LastPos = pItem->m_pObjectList->GetLastObjectPosition(); - if (m_ObjectPos == NULL) { + if (!m_ObjectPos) { if (LastPos == m_PrevLastPos) { if (!pItem->m_pObjectList->IsParsed()) { pItem->m_pObjectList->ContinueParse(pPause); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp index 7a28ddc782..babf70396b 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -74,7 +74,7 @@ void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) { } void CPDF_PageRenderCache::ClearImageCache(CPDF_Stream* pStream) { void* value = m_ImageCaches.GetValueAt(pStream); - if (value == NULL) { + if (!value) { m_ImageCaches.RemoveKey(pStream); return; } @@ -95,7 +95,7 @@ FX_DWORD CPDF_PageRenderCache::EstimateSize() { return dwSize; } FX_DWORD CPDF_PageRenderCache::GetCachedSize(CPDF_Stream* pStream) const { - if (pStream == NULL) { + if (!pStream) { return m_nCacheSize; } CPDF_ImageCache* pImageCache; @@ -175,7 +175,7 @@ void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap) { CPDF_ImageCache* pImageCache; if (!m_ImageCaches.Lookup(pStream, (void*&)pImageCache)) { - if (pBitmap == NULL) { + if (!pBitmap) { return; } pImageCache = new CPDF_ImageCache(m_pPage->m_pDocument, pStream); @@ -220,7 +220,7 @@ void CPDF_PageRenderCache::ClearImageData() { } } void CPDF_ImageCache::ClearImageData() { - if (m_pCachedBitmap && m_pCachedBitmap->GetBuffer() == NULL) { + if (m_pCachedBitmap && !m_pCachedBitmap->GetBuffer()) { ((CPDF_DIBSource*)m_pCachedBitmap)->ClearImageData(); } } diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index 938a495eb1..d3390517e9 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -29,7 +29,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int bitmap_alpha, int blend_mode, int Transparency) { - if (pDIBitmap == NULL) { + if (!pDIBitmap) { return; } FX_BOOL bIsolated = Transparency & PDFTRANS_ISOLATED; @@ -353,7 +353,7 @@ FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource() { return FALSE; } FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { - if (m_Loader.m_pBitmap == NULL) { + if (!m_Loader.m_pBitmap) { return FALSE; } m_BitmapAlpha = 255; @@ -363,7 +363,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { } m_pDIBSource = m_Loader.m_pBitmap; if (m_pRenderStatus->m_Options.m_ColorMode == RENDER_COLOR_ALPHA && - m_Loader.m_pMask == NULL) { + !m_Loader.m_pMask) { return StartBitmapAlpha(); } if (pGeneralState && pGeneralState->m_pTR) { @@ -844,7 +844,7 @@ FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause) { return TRUE; } CFX_DIBitmap* pBitmap = m_pTransformer->m_Storer.Detach(); - if (pBitmap == NULL) { + if (!pBitmap) { return FALSE; } if (pBitmap->IsAlphaMask()) { @@ -934,11 +934,11 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, m_pCS = NULL; m_Bpp = 3; CPDF_Object* pCSObj = pDict->GetElementValue("ColorSpace"); - if (pCSObj == NULL) { + if (!pCSObj) { return FALSE; } m_pCS = CPDF_ColorSpace::Load(pImageObj->m_pImage->GetDocument(), pCSObj); - if (m_pCS == NULL) { + if (!m_pCS) { return FALSE; } if (!_IsSupported(m_pCS)) { @@ -995,12 +995,12 @@ FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) { const uint8_t* src_scan; if (m_pDecoder) { src_scan = m_pDecoder->GetScanline(src_y); - if (src_scan == NULL) { + if (!src_scan) { break; } } else { src_scan = m_StreamAcc.GetData(); - if (src_scan == NULL) { + if (!src_scan) { break; } src_scan += src_y * src_pitch; @@ -1011,7 +1011,7 @@ FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) { int src_x = (m_bFlipX ? (m_DestWidth - dest_x - 1) : dest_x) * src_width / m_DestWidth; const uint8_t* src_pixel = src_scan + src_x * m_Bpp; - if (m_pCS == NULL) { + if (!m_pCS) { *result_scan = src_pixel[2]; result_scan++; *result_scan = src_pixel[1]; @@ -1040,7 +1040,7 @@ FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) { CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, FX_RECT* pClipRect, const CFX_Matrix* pMatrix) { - if (pSMaskDict == NULL) { + if (!pSMaskDict) { return NULL; } int width = pClipRect->right - pClipRect->left; @@ -1048,7 +1048,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, FX_BOOL bLuminosity = FALSE; bLuminosity = pSMaskDict->GetConstString("S") != "Alpha"; CPDF_Stream* pGroup = pSMaskDict->GetStream("G"); - if (pGroup == NULL) { + if (!pGroup) { return NULL; } nonstd::unique_ptr<CPDF_Function> pFunc; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index 521ec16be1..7b34c5721a 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -212,12 +212,12 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask) { - if (pStream == NULL) { + if (!pStream) { return FALSE; } m_pDocument = pDoc; m_pDict = pStream->GetDict(); - if (m_pDict == NULL) { + if (!m_pDict) { return FALSE; } m_pStream = pStream; @@ -243,7 +243,7 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, } m_pStreamAcc = new CPDF_StreamAcc; m_pStreamAcc->LoadAllData(pStream, FALSE, src_size.ValueOrDie(), TRUE); - if (m_pStreamAcc->GetSize() == 0 || m_pStreamAcc->GetData() == NULL) { + if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData()) { return FALSE; } if (!CreateDecoder()) { @@ -333,7 +333,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask) { - if (pStream == NULL) { + if (!pStream) { return 0; } m_pDocument = pDoc; @@ -363,7 +363,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, } m_pStreamAcc = new CPDF_StreamAcc; m_pStreamAcc->LoadAllData(pStream, FALSE, src_size.ValueOrDie(), TRUE); - if (m_pStreamAcc->GetSize() == 0 || m_pStreamAcc->GetData() == NULL) { + if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData()) { return 0; } int ret = CreateDecoder(); @@ -401,7 +401,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) { return 0; } ICodec_Jbig2Module* pJbig2Module = CPDF_ModuleMgr::Get()->GetJbig2Module(); - if (m_pJbig2Context == NULL) { + if (!m_pJbig2Context) { m_pJbig2Context = pJbig2Module->CreateJbig2Context(); if (m_pStreamAcc->GetImageParam()) { CPDF_Stream* pGlobals = @@ -531,7 +531,7 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, FX_BOOL& bColorKey) { - if (m_pColorSpace == NULL) { + if (!m_pColorSpace) { return NULL; } DIB_COMP_DATA* pCompData = FX_Alloc(DIB_COMP_DATA, m_nComponents); @@ -565,7 +565,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, } if (!m_pDict->KeyExist("SMask")) { CPDF_Object* pMask = m_pDict->GetElementValue("Mask"); - if (pMask == NULL) { + if (!pMask) { return pCompData; } if (CPDF_Array* pArray = pMask->AsArray()) { @@ -628,7 +628,7 @@ int CPDF_DIBSource::CreateDecoder() { return 0; } m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey); - if (m_pCompData == NULL) { + if (!m_pCompData) { return 0; } } @@ -807,7 +807,7 @@ int CPDF_DIBSource::StratLoadMask() { return m_pMaskStream ? StartLoadMaskDIB() : 1; } int CPDF_DIBSource::ContinueLoadMaskDIB(IFX_Pause* pPause) { - if (m_pMask == NULL) { + if (!m_pMask) { return 1; } int ret = m_pMask->ContinueLoadDIBSource(pPause); @@ -860,7 +860,7 @@ void CPDF_DIBSource::LoadPalette() { if (m_bpc * m_nComponents > 8) { return; } - if (m_pColorSpace == NULL) { + if (!m_pColorSpace) { return; } if (m_bpc * m_nComponents == 1) { @@ -1606,7 +1606,7 @@ FX_BOOL CPDF_ImageLoader::Load(const CPDF_ImageObject* pImage, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus) { - if (pImage == NULL) { + if (!pImage) { return FALSE; } if (pCache) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index 8b6c0d1fd1..9076b7ba20 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -21,7 +21,7 @@ static void DrawAxialShading(CFX_DIBitmap* pBitmap, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); CPDF_Array* pCoords = pDict->GetArray("Coords"); - if (pCoords == NULL) { + if (!pCoords) { return; } FX_FLOAT start_x = pCoords->GetNumber(0); @@ -112,7 +112,7 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); CPDF_Array* pCoords = pDict->GetArray("Coords"); - if (pCoords == NULL) { + if (!pCoords) { return; } FX_FLOAT start_x = pCoords->GetNumber(0); @@ -834,7 +834,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, int nFuncs = pPattern->m_nFuncs; CPDF_Dictionary* pDict = pPattern->m_pShadingObj->GetDict(); CPDF_ColorSpace* pColorSpace = pPattern->m_pCS; - if (pColorSpace == NULL) { + if (!pColorSpace) { return; } FX_ARGB background = 0; @@ -864,7 +864,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, CFX_Matrix FinalMatrix = *pMatrix; FinalMatrix.Concat(*buffer.GetMatrix()); CFX_DIBitmap* pBitmap = buffer.GetBitmap(); - if (pBitmap->GetBuffer() == NULL) { + if (!pBitmap->GetBuffer()) { return; } pBitmap->Clear(background); @@ -1121,7 +1121,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, m_pContext->m_pDocument, m_pContext->m_pPageCache, pPattern, pObj2Device, width, height, m_Options.m_Flags); } - if (pPatternBitmap == NULL) { + if (!pPatternBitmap) { m_pDevice->RestoreState(); return; } @@ -1185,7 +1185,7 @@ void CPDF_RenderStatus::DrawPathWithPattern(CPDF_PathObject* pPathObj, CPDF_Color* pColor, FX_BOOL bStroke) { CPDF_Pattern* pattern = pColor->GetPattern(); - if (pattern == NULL) { + if (!pattern) { return; } if (pattern->m_PatternType == PATTERN_TILING) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index 774e749322..05a5e040e3 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -163,11 +163,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; @@ -212,7 +212,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 { @@ -221,7 +221,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 { @@ -299,21 +299,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) { @@ -383,7 +383,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, continue; } CPDF_Type3Char* pType3Char = pType3Font->LoadChar(charcode); - if (pType3Char == NULL) { + if (!pType3Char) { continue; } CFX_Matrix matrix = char_matrix; @@ -394,7 +394,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, 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, @@ -452,7 +452,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, 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); @@ -491,7 +491,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, 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( @@ -557,7 +557,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); @@ -762,7 +762,7 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, 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; |