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

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

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits 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.cpp
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
index d7c3b6e6e87a1e0b27df15c1fe4d04cd0bcb5fb2..801f9e737cc70b9e13d1a17745be60c4faca95d7 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -434,7 +434,7 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj,
res = 0;
}
CPDF_ScaledRenderBuffer buffer;
- if (!buffer.Initialize(m_pContext, m_pDevice, &rect, pObj, &m_Options, res)) {
+ if (!buffer.Initialize(m_pContext, m_pDevice, rect, pObj, &m_Options, res)) {
return;
}
CFX_Matrix matrix = *pObj2Device;
@@ -537,12 +537,9 @@ FX_BOOL CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj,
m_curBlend);
}
CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const {
- ASSERT(pObj != NULL);
+ ASSERT(pObj);
CPDF_DocRenderData* pDocCache = m_pContext->m_pDocument->GetRenderData();
- if (!pDocCache) {
- return NULL;
- }
- return pDocCache->GetTransferFunc(pObj);
+ return pDocCache ? pDocCache->GetTransferFunc(pObj) : nullptr;
}
FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj,
FX_BOOL bType3) const {
@@ -1343,19 +1340,18 @@ CPDF_ScaledRenderBuffer::~CPDF_ScaledRenderBuffer() {}
#define _FPDFAPI_IMAGESIZE_LIMIT_ (30 * 1024 * 1024)
FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext,
CFX_RenderDevice* pDevice,
- FX_RECT* pRect,
+ const FX_RECT& pRect,
const CPDF_PageObject* pObj,
const CPDF_RenderOptions* pOptions,
int max_dpi) {
- FXSYS_assert(pRect != NULL);
m_pDevice = pDevice;
if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) {
return TRUE;
}
m_pContext = pContext;
- m_Rect = *pRect;
+ m_Rect = pRect;
m_pObject = pObj;
- m_Matrix.TranslateI(-pRect->left, -pRect->top);
+ m_Matrix.TranslateI(-pRect.left, -pRect.top);
int horz_size = pDevice->GetDeviceCaps(FXDC_HORZ_SIZE);
int vert_size = pDevice->GetDeviceCaps(FXDC_VERT_SIZE);
if (horz_size && vert_size && max_dpi) {
@@ -1380,7 +1376,7 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext,
CFX_FloatRect rect;
int32_t iWidth, iHeight, iPitch;
while (1) {
- rect = *pRect;
+ rect = pRect;
m_Matrix.TransformRect(rect);
FX_RECT bitmap_rect = rect.GetOutterRect();
iWidth = bitmap_rect.Width();
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698