summaryrefslogtreecommitdiff
path: root/core/src/fxge/dib/fx_dib_main.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-14 15:45:39 -0700
committerLei Zhang <thestig@chromium.org>2015-08-14 15:45:39 -0700
commitcb62e7657b3a9a04142028a4e6614029a08e894b (patch)
treee7fa5f4c7d7f12bff9315475a89872fb044c36b1 /core/src/fxge/dib/fx_dib_main.cpp
parent0f6b51c0fdd14f5762bf3c7412ac59c825443cc3 (diff)
downloadpdfium-cb62e7657b3a9a04142028a4e6614029a08e894b.tar.xz
Don't bother checking pointers before delete[] and FX_Free().
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1297713003 .
Diffstat (limited to 'core/src/fxge/dib/fx_dib_main.cpp')
-rw-r--r--core/src/fxge/dib/fx_dib_main.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp
index 3c886e5cfe..b98fc6b359 100644
--- a/core/src/fxge/dib/fx_dib_main.cpp
+++ b/core/src/fxge/dib/fx_dib_main.cpp
@@ -48,9 +48,7 @@ CFX_DIBSource::CFX_DIBSource() {
m_pAlphaMask = NULL;
}
CFX_DIBSource::~CFX_DIBSource() {
- if (m_pPalette) {
- FX_Free(m_pPalette);
- }
+ FX_Free(m_pPalette);
delete m_pAlphaMask;
}
CFX_DIBitmap::CFX_DIBitmap() {
@@ -102,7 +100,7 @@ FX_BOOL CFX_DIBitmap::Create(int width,
FX_BOOL ret = TRUE;
ret = BuildAlphaMask();
if (!ret) {
- if (!m_bExtBuf && m_pBuffer) {
+ if (!m_bExtBuf) {
FX_Free(m_pBuffer);
m_pBuffer = NULL;
m_Width = m_Height = m_Pitch = 0;
@@ -127,18 +125,16 @@ FX_BOOL CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) {
return TRUE;
}
CFX_DIBitmap::~CFX_DIBitmap() {
- if (m_pBuffer && !m_bExtBuf) {
+ if (!m_bExtBuf) {
FX_Free(m_pBuffer);
}
m_pBuffer = NULL;
}
void CFX_DIBitmap::TakeOver(CFX_DIBitmap* pSrcBitmap) {
- if (m_pBuffer && !m_bExtBuf) {
+ if (!m_bExtBuf) {
FX_Free(m_pBuffer);
}
- if (m_pPalette) {
- FX_Free(m_pPalette);
- }
+ FX_Free(m_pPalette);
delete m_pAlphaMask;
m_pBuffer = pSrcBitmap->m_pBuffer;
m_pPalette = pSrcBitmap->m_pPalette;
@@ -542,9 +538,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left,
}
void CFX_DIBSource::CopyPalette(const FX_DWORD* pSrc, FX_DWORD size) {
if (pSrc == NULL || GetBPP() > 8) {
- if (m_pPalette) {
- FX_Free(m_pPalette);
- }
+ FX_Free(m_pPalette);
m_pPalette = NULL;
} else {
FX_DWORD pal_size = 1 << GetBPP();
@@ -1519,9 +1513,7 @@ CFX_FilteredDIB::~CFX_FilteredDIB() {
if (m_bAutoDropSrc) {
delete m_pSrc;
}
- if (m_pScanline) {
- FX_Free(m_pScanline);
- }
+ FX_Free(m_pScanline);
}
void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc) {
m_pSrc = pSrc;