summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_render
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-07-16 18:45:22 -0700
committerLei Zhang <thestig@chromium.org>2015-07-16 18:45:22 -0700
commit796c908e7b7bdde819a1e5a4bfd3576d8e8859d6 (patch)
tree8c0cd763dd9bf70bc14da8f8cb7893835a3572fe /core/src/fpdfapi/fpdf_render
parentba026913c273a5c1c841bced288fdab03f10ad08 (diff)
downloadpdfium-796c908e7b7bdde819a1e5a4bfd3576d8e8859d6.tar.xz
Merge to XFA: Cleanup: Do not check pointers before deleting them, part 2.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1195363002 . (cherry picked from commit 21bf242a31eff79f754c5e9c3b41c52e33483bb0) Review URL: https://codereview.chromium.org/1235753006 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_render')
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render.cpp20
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp28
2 files changed, 12 insertions, 36 deletions
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
index c4a9d7761b..a894e846ee 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -202,9 +202,7 @@ CPDF_RenderStatus::CPDF_RenderStatus()
CPDF_RenderStatus::~CPDF_RenderStatus()
{
- if (m_pObjectRenderer) {
- delete m_pObjectRenderer;
- }
+ delete m_pObjectRenderer;
}
FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice,
@@ -665,9 +663,7 @@ void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_Affine
ProcessText(pText, pObj2Device, pTextClippingPath);
}
}
- if (pTextClippingPath) {
- delete pTextClippingPath;
- }
+ delete pTextClippingPath;
}
void CPDF_RenderStatus::DrawClipPath(CPDF_ClipPath ClipPath, const CFX_AffineMatrix* pObj2Device)
{
@@ -859,9 +855,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
Transparency |= PDFTRANS_GROUP;
}
CompositeDIBitmap(bitmap, rect.left, rect.top, 0, 255, blend_type, Transparency);
- if (oriDevice) {
- delete oriDevice;
- }
+ delete oriDevice;
return TRUE;
}
CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj, const FX_RECT& rect, int& left, int& top,
@@ -1271,9 +1265,7 @@ CPDF_DeviceBuffer::CPDF_DeviceBuffer()
}
CPDF_DeviceBuffer::~CPDF_DeviceBuffer()
{
- if (m_pBitmap) {
- delete m_pBitmap;
- }
+ delete m_pBitmap;
}
FX_BOOL CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, FX_RECT* pRect,
const CPDF_PageObject* pObj, int max_dpi)
@@ -1330,9 +1322,7 @@ CPDF_ScaledRenderBuffer::CPDF_ScaledRenderBuffer()
}
CPDF_ScaledRenderBuffer::~CPDF_ScaledRenderBuffer()
{
- if (m_pBitmapDevice) {
- delete m_pBitmapDevice;
- }
+ delete m_pBitmapDevice;
}
#define _FPDFAPI_IMAGESIZE_LIMIT_ (30 * 1024 * 1024)
FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, FX_RECT* pRect,
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
index f3f0375f53..0730206e23 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -297,21 +297,13 @@ CPDF_ImageRenderer::CPDF_ImageRenderer()
}
CPDF_ImageRenderer::~CPDF_ImageRenderer()
{
- if (m_pQuickStretcher) {
- delete m_pQuickStretcher;
- }
- if (m_pTransformer) {
- delete m_pTransformer;
- }
+ delete m_pQuickStretcher;
+ delete m_pTransformer;
if (m_DeviceHandle) {
m_pRenderStatus->m_pDevice->CancelDIBits(m_DeviceHandle);
}
- if (m_LoadHandle) {
- delete (CPDF_ProgressiveImageLoaderHandle*)m_LoadHandle;
- }
- if (m_pClone) {
- delete m_pClone;
- }
+ delete (CPDF_ProgressiveImageLoaderHandle*)m_LoadHandle;
+ delete m_pClone;
}
FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource()
{
@@ -813,15 +805,11 @@ CPDF_QuickStretcher::CPDF_QuickStretcher()
}
CPDF_QuickStretcher::~CPDF_QuickStretcher()
{
- if (m_pBitmap) {
- delete m_pBitmap;
- }
+ delete m_pBitmap;
if (m_pCS) {
m_pCS->ReleaseCS();
}
- if (m_pDecoder) {
- delete m_pDecoder;
- }
+ delete m_pDecoder;
}
ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int nComps, int bpc, const CPDF_Dictionary* pParams);
@@ -1085,9 +1073,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
} else {
FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height);
}
- if (pFunc) {
- delete pFunc;
- }
+ delete pFunc;
FX_Free(pTransfer);
return pMask;
}