summaryrefslogtreecommitdiff
path: root/core/src/fxge/dib/fx_dib_convert.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-14 22:22:13 -0700
committerLei Zhang <thestig@chromium.org>2015-08-14 22:22:13 -0700
commitda180e9fdd4385df024cc18046f62ca47bc74d74 (patch)
tree931e0e64ac2cbc82e3718e43418ee6bd676da4a5 /core/src/fxge/dib/fx_dib_convert.cpp
parent2b1a2d528469cda4e9f3e36d3c7a649e0d476480 (diff)
downloadpdfium-da180e9fdd4385df024cc18046f62ca47bc74d74.tar.xz
Merge to XFA: Don't bother checking pointers before delete[] and FX_Free().
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1297713003 . (cherry picked from commit cb62e7657b3a9a04142028a4e6614029a08e894b) Review URL: https://codereview.chromium.org/1287053005 .
Diffstat (limited to 'core/src/fxge/dib/fx_dib_convert.cpp')
-rw-r--r--core/src/fxge/dib/fx_dib_convert.cpp44
1 files changed, 12 insertions, 32 deletions
diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp
index 950f72925a..93e741158c 100644
--- a/core/src/fxge/dib/fx_dib_convert.cpp
+++ b/core/src/fxge/dib/fx_dib_convert.cpp
@@ -202,36 +202,24 @@ CFX_Palette::CFX_Palette() {
m_lut = 0;
}
CFX_Palette::~CFX_Palette() {
- if (m_pPalette) {
- FX_Free(m_pPalette);
- }
- if (m_cLut) {
- FX_Free(m_cLut);
- }
- if (m_aLut) {
- FX_Free(m_aLut);
- }
+ FX_Free(m_pPalette);
+ FX_Free(m_cLut);
+ FX_Free(m_aLut);
m_lut = 0;
}
FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) {
if (pBitmap == NULL) {
return FALSE;
}
- if (m_pPalette != NULL) {
- FX_Free(m_pPalette);
- }
+ FX_Free(m_pPalette);
m_pPalette = FX_Alloc(FX_DWORD, 256);
int bpp = pBitmap->GetBPP() / 8;
int width = pBitmap->GetWidth();
int height = pBitmap->GetHeight();
- if (m_cLut) {
- FX_Free(m_cLut);
- m_cLut = NULL;
- }
- if (m_aLut) {
- FX_Free(m_aLut);
- m_aLut = NULL;
- }
+ FX_Free(m_cLut);
+ m_cLut = NULL;
+ FX_Free(m_aLut);
+ m_aLut = NULL;
m_cLut = FX_Alloc(FX_DWORD, 4096);
m_aLut = FX_Alloc(FX_DWORD, 4096);
int row, col;
@@ -1142,9 +1130,7 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format,
ret = ConvertBuffer(dest_format, pClone->GetBuffer(), pClone->GetPitch(),
m_Width, m_Height, this, 0, 0, pal_8bpp, pIccTransform);
if (!ret) {
- if (pal_8bpp) {
- FX_Free(pal_8bpp);
- }
+ FX_Free(pal_8bpp);
delete pClone;
return NULL;
}
@@ -1222,24 +1208,18 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format,
ret = ConvertBuffer(dest_format, dest_buf, dest_pitch, m_Width, m_Height,
this, 0, 0, pal_8bpp, pIccTransform);
if (!ret) {
- if (pal_8bpp) {
- FX_Free(pal_8bpp);
- }
+ FX_Free(pal_8bpp);
if (pAlphaMask != m_pAlphaMask) {
delete pAlphaMask;
}
- if (dest_buf) {
- FX_Free(dest_buf);
- }
+ FX_Free(dest_buf);
return FALSE;
}
if (m_pAlphaMask && pAlphaMask != m_pAlphaMask) {
delete m_pAlphaMask;
}
m_pAlphaMask = pAlphaMask;
- if (m_pPalette) {
- FX_Free(m_pPalette);
- }
+ FX_Free(m_pPalette);
m_pPalette = pal_8bpp;
if (!m_bExtBuf) {
FX_Free(m_pBuffer);