diff options
Diffstat (limited to 'core/fpdfapi/fpdf_render')
-rw-r--r-- | core/fpdfapi/fpdf_render/cpdf_pagerendercache.h | 4 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render.cpp | 55 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render_cache.cpp | 28 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render_image.cpp | 77 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render_text.cpp | 26 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/render_int.h | 18 |
7 files changed, 107 insertions, 105 deletions
diff --git a/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h b/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h index 4f9ea1fe46..df0d73ac64 100644 --- a/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h +++ b/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h @@ -41,7 +41,7 @@ class CPDF_PageRenderCache { FX_BOOL bStdCS = FALSE, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, + CPDF_RenderStatus* pRenderStatus = nullptr, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); @@ -56,7 +56,7 @@ class CPDF_PageRenderCache { FX_BOOL bStdCS = FALSE, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, + CPDF_RenderStatus* pRenderStatus = nullptr, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index 6ac78ecd43..7e8c8348a5 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -61,7 +61,7 @@ void CPDF_DocRenderData::Clear(FX_BOOL bRelease) { if (m_pFontCache) { if (bRelease) { delete m_pFontCache; - m_pFontCache = NULL; + m_pFontCache = nullptr; } else { m_pFontCache->FreeCache(FALSE); } @@ -92,7 +92,7 @@ CPDF_RenderOptions::CPDF_RenderOptions() m_Flags(RENDER_CLEARTYPE), m_Interpolation(0), m_AddFlags(0), - m_pOCContext(NULL), + m_pOCContext(nullptr), m_dwLimitCacheSize(1024 * 1024 * 100), m_HalftoneLimit(-1) {} FX_ARGB CPDF_RenderOptions::TranslateColor(FX_ARGB argb) const { @@ -324,7 +324,7 @@ void CPDF_RenderStatus::ProcessObjectNoClip(const CPDF_PageObject* pObj, FX_BOOL bRet = FALSE; switch (pObj->GetType()) { case CPDF_PageObject::TEXT: - bRet = ProcessText(pObj->AsText(), pObj2Device, NULL); + bRet = ProcessText(pObj->AsText(), pObj2Device, nullptr); break; case CPDF_PageObject::PATH: bRet = ProcessPath(pObj->AsPath(), pObj2Device); @@ -384,7 +384,7 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, CFX_Matrix matrix = *pObj2Device; matrix.Concat(*buffer.GetMatrix()); GetScaledMatrix(matrix); - CPDF_Dictionary* pFormResource = NULL; + CPDF_Dictionary* pFormResource = nullptr; if (pObj->IsForm()) { const CPDF_FormObject* pFormObj = pObj->AsForm(); if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { @@ -392,9 +392,9 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, } } CPDF_RenderStatus status; - status.Initialize(m_pContext, buffer.GetDevice(), buffer.GetMatrix(), NULL, - NULL, NULL, &m_Options, m_Transparency, m_bDropObjects, - pFormResource); + status.Initialize(m_pContext, buffer.GetDevice(), buffer.GetMatrix(), nullptr, + nullptr, nullptr, &m_Options, m_Transparency, + m_bDropObjects, pFormResource); status.RenderSingleObject(pObj, &matrix); buffer.OutputToDevice(); } @@ -407,12 +407,12 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj, } CFX_Matrix matrix = pFormObj->m_FormMatrix; matrix.Concat(*pObj2Device); - CPDF_Dictionary* pResources = NULL; + CPDF_Dictionary* pResources = nullptr; if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { pResources = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); } CPDF_RenderStatus status; - status.Initialize(m_pContext, m_pDevice, NULL, m_pStopObj, this, pFormObj, + status.Initialize(m_pContext, m_pDevice, nullptr, m_pStopObj, this, pFormObj, &m_Options, m_Transparency, m_bDropObjects, pResources, FALSE); status.m_curBlend = m_curBlend; @@ -669,14 +669,14 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, return TRUE; } CPDF_Dictionary* pSMaskDict = - pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : NULL; + pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : nullptr; if (pSMaskDict) { if (pPageObj->IsImage() && pPageObj->AsImage()->m_pImage->GetDict()->KeyExist("SMask")) { - pSMaskDict = NULL; + pSMaskDict = nullptr; } } - CPDF_Dictionary* pFormResource = NULL; + CPDF_Dictionary* pFormResource = nullptr; FX_FLOAT group_alpha = 1.0f; int Transparency = m_Transparency; FX_BOOL bGroupTransparent = FALSE; @@ -701,15 +701,15 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, } if ((m_Options.m_Flags & RENDER_OVERPRINT) && pPageObj->IsImage() && pGeneralState && pGeneralState->m_FillOP && pGeneralState->m_StrokeOP) { - CPDF_Document* pDocument = NULL; - CPDF_Page* pPage = NULL; + CPDF_Document* pDocument = nullptr; + CPDF_Page* pPage = nullptr; if (m_pContext->GetPageCache()) { pPage = m_pContext->GetPageCache()->GetPage(); pDocument = pPage->m_pDocument; } else { pDocument = pPageObj->AsImage()->m_pImage->GetDocument(); } - CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : NULL; + CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : nullptr; CPDF_Object* pCSObj = pPageObj->AsImage() ->m_pImage->GetStream() ->GetDict() @@ -796,9 +796,9 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, } } CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pContext, &bitmap_device, NULL, m_pStopObj, NULL, - NULL, &m_Options, 0, m_bDropObjects, pFormResource, - TRUE); + bitmap_render.Initialize(m_pContext, &bitmap_device, nullptr, m_pStopObj, + nullptr, nullptr, &m_Options, 0, m_bDropObjects, + pFormResource, TRUE); bitmap_render.ProcessObjectNoClip(pPageObj, &new_matrix); m_bStopped = bitmap_render.m_bStopped; if (pSMaskDict) { @@ -891,7 +891,7 @@ CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates( const CPDF_GraphicStates* pSrcStates, FX_BOOL bStroke) { if (!pSrcStates) { - return NULL; + return nullptr; } CPDF_GraphicStates* pStates = new CPDF_GraphicStates; pStates->CopyStates(*pSrcStates); @@ -935,7 +935,7 @@ void CPDF_RenderContext::AppendLayer(CPDF_PageObjectHolder* pObjectHolder, void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, const CPDF_RenderOptions* pOptions, const CFX_Matrix* pLastMatrix) { - Render(pDevice, NULL, pOptions, pLastMatrix); + Render(pDevice, nullptr, pOptions, pLastMatrix); } void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, const CPDF_PageObject* pStopObj, @@ -949,9 +949,9 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, CFX_Matrix FinalMatrix = pLayer->m_Matrix; FinalMatrix.Concat(*pLastMatrix); CPDF_RenderStatus status; - status.Initialize(this, pDevice, pLastMatrix, pStopObj, NULL, NULL, + status.Initialize(this, pDevice, pLastMatrix, pStopObj, nullptr, nullptr, pOptions, pLayer->m_pObjectHolder->m_Transparency, - FALSE, NULL); + FALSE, nullptr); status.RenderObjectList(pLayer->m_pObjectHolder, &FinalMatrix); if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); @@ -962,8 +962,9 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, } } else { CPDF_RenderStatus status; - status.Initialize(this, pDevice, NULL, pStopObj, NULL, NULL, pOptions, - pLayer->m_pObjectHolder->m_Transparency, FALSE, NULL); + status.Initialize(this, pDevice, nullptr, pStopObj, nullptr, nullptr, + pOptions, pLayer->m_pObjectHolder->m_Transparency, + FALSE, nullptr); status.RenderObjectList(pLayer->m_pObjectHolder, &pLayer->m_Matrix); if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); @@ -1014,8 +1015,8 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { m_pCurrentLayer->m_pObjectHolder->GetPageObjectList()->end(); m_pRenderStatus.reset(new CPDF_RenderStatus()); m_pRenderStatus->Initialize( - m_pContext, m_pDevice, NULL, NULL, NULL, NULL, m_pOptions, - m_pCurrentLayer->m_pObjectHolder->m_Transparency, FALSE, NULL); + m_pContext, m_pDevice, nullptr, nullptr, nullptr, nullptr, m_pOptions, + m_pCurrentLayer->m_pObjectHolder->m_Transparency, FALSE, nullptr); m_pDevice->SaveState(); m_ClipRect = CFX_FloatRect(m_pDevice->GetClipBox()); CFX_Matrix device2object; @@ -1204,7 +1205,7 @@ void CPDF_DeviceBuffer::OutputToDevice() { CFX_DIBitmap buffer; m_pDevice->CreateCompatibleBitmap(&buffer, m_pBitmap->GetWidth(), m_pBitmap->GetHeight()); - m_pContext->GetBackground(&buffer, m_pObject, NULL, &m_Matrix); + m_pContext->GetBackground(&buffer, m_pObject, nullptr, &m_Matrix); buffer.CompositeBitmap(0, 0, buffer.GetWidth(), buffer.GetHeight(), m_pBitmap.get(), 0, 0); m_pDevice->StretchDIBits(&buffer, m_Rect.left, m_Rect.top, m_Rect.Width(), diff --git a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp index b0539a2014..07fa2e7b82 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -166,14 +166,14 @@ void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream, CPDF_ImageCacheEntry::CPDF_ImageCacheEntry(CPDF_Document* pDoc, CPDF_Stream* pStream) : m_dwTimeCount(0), - m_pCurBitmap(NULL), - m_pCurMask(NULL), + m_pCurBitmap(nullptr), + m_pCurMask(nullptr), m_MatteColor(0), - m_pRenderStatus(NULL), + m_pRenderStatus(nullptr), m_pDocument(pDoc), m_pStream(pStream), - m_pCachedBitmap(NULL), - m_pCachedMask(NULL), + m_pCachedBitmap(nullptr), + m_pCachedMask(nullptr), m_dwCacheSize(0) {} CPDF_ImageCacheEntry::~CPDF_ImageCacheEntry() { delete m_pCachedBitmap; @@ -181,7 +181,7 @@ CPDF_ImageCacheEntry::~CPDF_ImageCacheEntry() { } void CPDF_ImageCacheEntry::Reset(const CFX_DIBitmap* pBitmap) { delete m_pCachedBitmap; - m_pCachedBitmap = NULL; + m_pCachedBitmap = nullptr; if (pBitmap) { m_pCachedBitmap = pBitmap->Clone(); } @@ -217,12 +217,12 @@ FX_BOOL CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap, CPDF_PageRenderCache* pPageRenderCache = pContext->GetPageCache(); m_dwTimeCount = pPageRenderCache->GetTimeCount(); CPDF_DIBSource* pSrc = new CPDF_DIBSource; - CPDF_DIBSource* pMaskSrc = NULL; + CPDF_DIBSource* pMaskSrc = nullptr; if (!pSrc->Load(m_pDocument, m_pStream, &pMaskSrc, &MatteColor, pRenderStatus->m_pFormResource, pPageResources, bStdCS, GroupFamily, bLoadMask)) { delete pSrc; - pBitmap = NULL; + pBitmap = nullptr; return FALSE; } m_MatteColor = MatteColor; @@ -244,12 +244,12 @@ FX_BOOL CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap, } CFX_DIBSource* CPDF_ImageCacheEntry::DetachBitmap() { CFX_DIBSource* pDIBSource = m_pCurBitmap; - m_pCurBitmap = NULL; + m_pCurBitmap = nullptr; return pDIBSource; } CFX_DIBSource* CPDF_ImageCacheEntry::DetachMask() { CFX_DIBSource* pDIBSource = m_pCurMask; - m_pCurMask = NULL; + m_pCurMask = nullptr; return pDIBSource; } int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, @@ -279,7 +279,7 @@ int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, } if (!ret) { delete m_pCurBitmap; - m_pCurBitmap = NULL; + m_pCurBitmap = nullptr; return 0; } ContinueGetCachedBitmap(); @@ -295,14 +295,14 @@ void CPDF_ImageCacheEntry::ContinueGetCachedBitmap() { FPDF_HUGE_IMAGE_SIZE) { m_pCachedBitmap = m_pCurBitmap->Clone(); delete m_pCurBitmap; - m_pCurBitmap = NULL; + m_pCurBitmap = nullptr; } else { m_pCachedBitmap = m_pCurBitmap; } if (m_pCurMask) { m_pCachedMask = m_pCurMask->Clone(); delete m_pCurMask; - m_pCurMask = NULL; + m_pCurMask = nullptr; } m_pCurBitmap = m_pCachedBitmap; m_pCurMask = m_pCachedMask; @@ -315,7 +315,7 @@ int CPDF_ImageCacheEntry::Continue(IFX_Pause* pPause) { } if (!ret) { delete m_pCurBitmap; - m_pCurBitmap = NULL; + m_pCurBitmap = nullptr; return 0; } ContinueGetCachedBitmap(); diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp index acfb20314a..76a6d4e764 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -31,7 +31,7 @@ FX_BOOL CPDF_RenderStatus::ProcessImage(const CPDF_ImageObject* pImageObj, const CFX_Matrix* pObj2Device) { CPDF_ImageRenderer render; if (render.Start(this, pImageObj, pObj2Device, m_bStdCS, m_curBlend)) { - render.Continue(NULL); + render.Continue(nullptr); } return render.m_Result; } @@ -89,7 +89,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), top + pDIBitmap->GetHeight()); rect.Intersect(m_pDevice->GetClipBox()); - CFX_DIBitmap* pClone = NULL; + CFX_DIBitmap* pClone = nullptr; FX_BOOL bClone = FALSE; if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) { bClone = TRUE; @@ -315,19 +315,19 @@ void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf, } } CPDF_ImageRenderer::CPDF_ImageRenderer() { - m_pRenderStatus = NULL; - m_pImageObject = NULL; + m_pRenderStatus = nullptr; + m_pImageObject = nullptr; m_Result = TRUE; m_Status = 0; - m_pTransformer = NULL; - m_DeviceHandle = NULL; - m_LoadHandle = NULL; - m_pClone = NULL; + m_pTransformer = nullptr; + m_DeviceHandle = nullptr; + m_LoadHandle = nullptr; + m_pClone = nullptr; m_bStdCS = FALSE; m_bPatternColor = FALSE; m_BlendType = FXDIB_BLEND_NORMAL; - m_pPattern = NULL; - m_pObj2Device = NULL; + m_pPattern = nullptr; + m_pObj2Device = nullptr; } CPDF_ImageRenderer::~CPDF_ImageRenderer() { delete m_pTransformer; @@ -392,7 +392,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { } m_FillArgb = 0; m_bPatternColor = FALSE; - m_pPattern = NULL; + m_pPattern = nullptr; if (m_pDIBSource->IsAlphaMask()) { CPDF_Color* pColor = m_pImageObject->m_ColorState.GetFillColor(); if (pColor && pColor->IsPattern()) { @@ -450,15 +450,15 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { pGeneralState->m_OPMode == 0 && pGeneralState->m_BlendType == FXDIB_BLEND_NORMAL && pGeneralState->m_StrokeAlpha == 1 && pGeneralState->m_FillAlpha == 1) { - CPDF_Document* pDocument = NULL; - CPDF_Page* pPage = NULL; + CPDF_Document* pDocument = nullptr; + CPDF_Page* pPage = nullptr; if (m_pRenderStatus->m_pContext->GetPageCache()) { pPage = m_pRenderStatus->m_pContext->GetPageCache()->GetPage(); pDocument = pPage->m_pDocument; } else { pDocument = m_pImageObject->m_pImage->GetDocument(); } - CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : NULL; + CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : nullptr; CPDF_Object* pCSObj = m_pImageObject->m_pImage->GetStream()->GetDict()->GetDirectObjectBy( "ColorSpace"); @@ -537,9 +537,10 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { bitmap_device1.GetBitmap()->Clear(0xffffff); { CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, NULL, - NULL, NULL, NULL, &m_pRenderStatus->m_Options, 0, - m_pRenderStatus->m_bDropObjects, NULL, TRUE); + bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, + nullptr, nullptr, nullptr, nullptr, + &m_pRenderStatus->m_Options, 0, + m_pRenderStatus->m_bDropObjects, nullptr, TRUE); CFX_Matrix patternDevice = *pObj2Device; patternDevice.Translate((FX_FLOAT)-rect.left, (FX_FLOAT)-rect.top); if (CPDF_TilingPattern* pTilingPattern = m_pPattern->AsTilingPattern()) { @@ -559,13 +560,13 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { } bitmap_device2.GetBitmap()->Clear(0); CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, NULL, - NULL, NULL, NULL, NULL, 0, - m_pRenderStatus->m_bDropObjects, NULL, TRUE); + bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, + nullptr, nullptr, nullptr, nullptr, nullptr, 0, + m_pRenderStatus->m_bDropObjects, nullptr, TRUE); CPDF_ImageRenderer image_render; if (image_render.Start(&bitmap_render, m_pDIBSource, 0xffffffff, 255, &new_matrix, m_Flags, TRUE)) { - image_render.Continue(NULL); + image_render.Continue(nullptr); } if (m_Loader.m_MatteColor != 0xffffffff) { int matte_r = FXARGB_R(m_Loader.m_MatteColor); @@ -636,13 +637,13 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() { bitmap_device1.GetBitmap()->Clear(0xffffff); { CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, NULL, - NULL, NULL, NULL, NULL, 0, - m_pRenderStatus->m_bDropObjects, NULL, TRUE); + bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, + nullptr, nullptr, nullptr, nullptr, nullptr, 0, + m_pRenderStatus->m_bDropObjects, nullptr, TRUE); CPDF_ImageRenderer image_render; if (image_render.Start(&bitmap_render, m_pDIBSource, 0, 255, &new_matrix, m_Flags, TRUE)) { - image_render.Continue(NULL); + image_render.Continue(nullptr); } } { @@ -652,13 +653,13 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() { bitmap_device2.GetBitmap()->Clear(0); CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, NULL, - NULL, NULL, NULL, NULL, 0, - m_pRenderStatus->m_bDropObjects, NULL, TRUE); + bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, + nullptr, nullptr, nullptr, nullptr, nullptr, 0, + m_pRenderStatus->m_bDropObjects, nullptr, TRUE); CPDF_ImageRenderer image_render; if (image_render.Start(&bitmap_render, m_Loader.m_pMask, 0xffffffff, 255, &new_matrix, m_Flags, TRUE)) { - image_render.Continue(NULL); + image_render.Continue(nullptr); } if (m_Loader.m_MatteColor != 0xffffffff) { int matte_r = FXARGB_R(m_Loader.m_MatteColor); @@ -803,7 +804,7 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() { path.Transform(&m_ImageMatrix); uint32_t fill_color = ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha); - m_pRenderStatus->m_pDevice->DrawPath(&path, NULL, NULL, fill_color, 0, + m_pRenderStatus->m_pDevice->DrawPath(&path, nullptr, nullptr, fill_color, 0, FXFILL_WINDING); } else { const CFX_DIBSource* pAlphaMask = m_pDIBSource->IsAlphaMask() @@ -922,8 +923,8 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, return nullptr; CFX_DIBitmap& bitmap = *bitmap_device.GetBitmap(); - CPDF_Object* pCSObj = NULL; - CPDF_ColorSpace* pCS = NULL; + CPDF_Object* pCSObj = nullptr; + CPDF_ColorSpace* pCS = nullptr; if (bLuminosity) { CPDF_Array* pBC = pSMaskDict->GetArrayBy("BC"); FX_ARGB back_color = 0xff000000; @@ -932,7 +933,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, if (pDict && pDict->GetDictBy("Group")) pCSObj = pDict->GetDictBy("Group")->GetDirectObjectBy("CS"); else - pCSObj = NULL; + pCSObj = nullptr; pCS = m_pContext->GetDocument()->LoadColorSpace(pCSObj); if (pCS) { FX_FLOAT R, G, B; @@ -945,7 +946,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, FX_SAFE_UINT32 num_floats = comps; num_floats *= sizeof(FX_FLOAT); if (!num_floats.IsValid()) { - return NULL; + return nullptr; } FXSYS_memset(pFloats, 0, num_floats.ValueOrDie()); size_t count = pBC->GetCount() > 8 ? 8 : pBC->GetCount(); @@ -962,16 +963,16 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, } else { bitmap.Clear(0); } - CPDF_Dictionary* pFormResource = NULL; + CPDF_Dictionary* pFormResource = nullptr; if (form.m_pFormDict) { pFormResource = form.m_pFormDict->GetDictBy("Resources"); } CPDF_RenderOptions options; options.m_ColorMode = bLuminosity ? RENDER_COLOR_NORMAL : RENDER_COLOR_ALPHA; CPDF_RenderStatus status; - status.Initialize(m_pContext, &bitmap_device, NULL, NULL, NULL, NULL, - &options, 0, m_bDropObjects, pFormResource, TRUE, NULL, 0, - pCS ? pCS->GetFamily() : 0, bLuminosity); + status.Initialize(m_pContext, &bitmap_device, nullptr, nullptr, nullptr, + nullptr, &options, 0, m_bDropObjects, pFormResource, TRUE, + nullptr, 0, pCS ? pCS->GetFamily() : 0, bLuminosity); status.RenderObjectList(&form, &matrix); std::unique_ptr<CFX_DIBitmap> pMask(new CFX_DIBitmap); if (!pMask->Create(width, height, FXDIB_8bppMask)) diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index 7896f83459..20278f71d9 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -677,7 +677,7 @@ struct CPDF_PatchDrawer { fillFlags |= FXFILL_NOPATHSMOOTH; } pDevice->DrawPath( - &path, NULL, NULL, + &path, nullptr, nullptr, FXARGB_MAKE(alpha, div_colors[0].comp[0], div_colors[0].comp[1], div_colors[0].comp[2]), 0, fillFlags); @@ -1044,7 +1044,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, if (width > clip_box.Width() || height > clip_box.Height() || width * height > clip_box.Width() * clip_box.Height()) { - CPDF_GraphicStates* pStates = NULL; + CPDF_GraphicStates* pStates = nullptr; if (!pPattern->colored()) pStates = CloneObjStates(pPageObj, bStroke); diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp index a3df1c2214..43816c4d99 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -328,7 +328,7 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, CPDF_Type3Cache* CPDF_RenderStatus::GetCachedType3(CPDF_Type3Font* pFont) { if (!pFont->m_pDocument) { - return NULL; + return nullptr; } pFont->m_pDocument->GetPageData()->GetFont(pFont->GetFontDict(), FALSE); return pFont->m_pDocument->GetRenderData()->GetCachedType3(pFont); @@ -415,17 +415,17 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, CPDF_RenderOptions Options = m_Options; Options.m_Flags |= RENDER_FORCE_HALFTONE | RENDER_RECT_AA; Options.m_Flags &= ~RENDER_FORCE_DOWNSAMPLE; - CPDF_Dictionary* pFormResource = NULL; + CPDF_Dictionary* pFormResource = nullptr; if (pType3Char->m_pForm && pType3Char->m_pForm->m_pFormDict) { pFormResource = pType3Char->m_pForm->m_pFormDict->GetDictBy("Resources"); } if (fill_alpha == 255) { CPDF_RenderStatus status; - status.Initialize(m_pContext, m_pDevice, NULL, NULL, this, pStates, - &Options, pType3Char->m_pForm->m_Transparency, - m_bDropObjects, pFormResource, FALSE, pType3Char, - fill_argb); + status.Initialize(m_pContext, m_pDevice, nullptr, nullptr, this, + pStates, &Options, + pType3Char->m_pForm->m_Transparency, m_bDropObjects, + pFormResource, FALSE, pType3Char, fill_argb); status.m_Type3FontCache.Append(m_Type3FontCache); status.m_Type3FontCache.Add(pType3Font); m_pDevice->SaveState(); @@ -443,10 +443,10 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, } bitmap_device.GetBitmap()->Clear(0); CPDF_RenderStatus status; - status.Initialize(m_pContext, &bitmap_device, NULL, NULL, this, pStates, - &Options, pType3Char->m_pForm->m_Transparency, - m_bDropObjects, pFormResource, FALSE, pType3Char, - fill_argb); + status.Initialize(m_pContext, &bitmap_device, nullptr, nullptr, this, + pStates, &Options, + pType3Char->m_pForm->m_Transparency, m_bDropObjects, + pFormResource, FALSE, pType3Char, fill_argb); status.m_Type3FontCache.Append(m_Type3FontCache); status.m_Type3FontCache.Add(pType3Font); matrix.TranslateI(-rect.left, -rect.top); @@ -527,7 +527,7 @@ class CPDF_CharPosList { }; CPDF_CharPosList::CPDF_CharPosList() { - m_pCharPos = NULL; + m_pCharPos = nullptr; } CPDF_CharPosList::~CPDF_CharPosList() { @@ -641,7 +641,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, if (nChars == 1) { charcode = pFont->GetNextChar(str.c_str(), str.GetLength(), offset); pCharCodes = (uint32_t*)(uintptr_t)charcode; - pCharPos = NULL; + pCharPos = nullptr; } else { pCharCodes = FX_Alloc(uint32_t, nChars); pCharPos = FX_Alloc(FX_FLOAT, nChars - 1); @@ -690,7 +690,7 @@ FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, const CPDF_RenderOptions* pOptions) { CFX_FontCache* pCache = pFont->m_pDocument ? pFont->m_pDocument->GetRenderData()->GetFontCache() - : NULL; + : nullptr; CPDF_CharPosList CharPosList; CharPosList.Load(nChars, pCharCodes, pCharPos, pFont, font_size); int FXGE_flags = 0; diff --git a/core/fpdfapi/fpdf_render/render_int.h b/core/fpdfapi/fpdf_render/render_int.h index 98822797b0..f373b9371a 100644 --- a/core/fpdfapi/fpdf_render/render_int.h +++ b/core/fpdfapi/fpdf_render/render_int.h @@ -98,7 +98,7 @@ class CPDF_TransferFunc { class CPDF_DocRenderData { public: - CPDF_DocRenderData(CPDF_Document* pPDFDoc = NULL); + CPDF_DocRenderData(CPDF_Document* pPDFDoc = nullptr); ~CPDF_DocRenderData(); CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObj); @@ -133,9 +133,9 @@ class CPDF_RenderStatus { const CPDF_RenderOptions* pOptions, int transparency, FX_BOOL bDropObjects, - CPDF_Dictionary* pFormResource = NULL, + CPDF_Dictionary* pFormResource = nullptr, FX_BOOL bStdCS = FALSE, - CPDF_Type3Char* pType3Char = NULL, + CPDF_Type3Char* pType3Char = nullptr, FX_ARGB fill_color = 0, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE); @@ -291,7 +291,7 @@ class CPDF_ImageLoader { FX_BOOL bStdCS = FALSE, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, + CPDF_RenderStatus* pRenderStatus = nullptr, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); FX_BOOL Continue(CPDF_ImageLoaderHandle* LoadHandle, IFX_Pause* pPause); @@ -316,7 +316,7 @@ class CPDF_ImageLoaderHandle { FX_BOOL bStdCS = FALSE, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, + CPDF_RenderStatus* pRenderStatus = nullptr, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); FX_BOOL Continue(IFX_Pause* pPause); @@ -389,7 +389,7 @@ class CPDF_ScaledRenderBuffer { CFX_RenderDevice* pDevice, const FX_RECT& pRect, const CPDF_PageObject* pObj, - const CPDF_RenderOptions* pOptions = NULL, + const CPDF_RenderOptions* pOptions = nullptr, int max_dpi = 0); CFX_RenderDevice* GetDevice() { return m_pBitmapDevice ? m_pBitmapDevice.get() : m_pDevice; @@ -441,7 +441,7 @@ class CPDF_ImageCacheEntry { FX_BOOL bStdCS = FALSE, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, + CPDF_RenderStatus* pRenderStatus = nullptr, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); uint32_t EstimateSize() const { return m_dwCacheSize; } @@ -456,7 +456,7 @@ class CPDF_ImageCacheEntry { FX_BOOL bStdCS = FALSE, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, + CPDF_RenderStatus* pRenderStatus = nullptr, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); int Continue(IFX_Pause* pPause); @@ -610,7 +610,7 @@ class CPDF_DIBTransferFunc : public CFX_FilteredDIB { // CFX_FilteredDIB FXDIB_Format GetDestFormat() override; - FX_ARGB* GetDestPalette() override { return NULL; } + FX_ARGB* GetDestPalette() override { return nullptr; } void TranslateScanline(uint8_t* dest_buf, const uint8_t* src_buf) const override; void TranslateDownSamples(uint8_t* dest_buf, |