summaryrefslogtreecommitdiff
path: root/core/src/fxge/dib
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxge/dib')
-rw-r--r--core/src/fxge/dib/dib_int.h4
-rw-r--r--core/src/fxge/dib/fx_dib_composite.cpp24
-rw-r--r--core/src/fxge/dib/fx_dib_convert.cpp44
-rw-r--r--core/src/fxge/dib/fx_dib_engine.cpp30
-rw-r--r--core/src/fxge/dib/fx_dib_main.cpp22
5 files changed, 34 insertions, 90 deletions
diff --git a/core/src/fxge/dib/dib_int.h b/core/src/fxge/dib/dib_int.h
index 74e77d46da..d40e3a4f95 100644
--- a/core/src/fxge/dib/dib_int.h
+++ b/core/src/fxge/dib/dib_int.h
@@ -35,9 +35,7 @@ class CWeightTable {
public:
CWeightTable() { m_pWeightTables = NULL; }
~CWeightTable() {
- if (m_pWeightTables) {
- FX_Free(m_pWeightTables);
- }
+ FX_Free(m_pWeightTables);
m_pWeightTables = NULL;
}
void Calc(int dest_len,
diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp
index 84062d80b1..89a52f3dba 100644
--- a/core/src/fxge/dib/fx_dib_composite.cpp
+++ b/core/src/fxge/dib/fx_dib_composite.cpp
@@ -4193,12 +4193,8 @@ CFX_ScanlineCompositor::CFX_ScanlineCompositor() {
m_BlendType = FXDIB_BLEND_NORMAL;
}
CFX_ScanlineCompositor::~CFX_ScanlineCompositor() {
- if (m_pSrcPalette) {
- FX_Free(m_pSrcPalette);
- }
- if (m_pCacheScanline) {
- FX_Free(m_pCacheScanline);
- }
+ FX_Free(m_pSrcPalette);
+ FX_Free(m_pCacheScanline);
}
FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format,
FXDIB_Format src_format,
@@ -5010,18 +5006,10 @@ CFX_BitmapComposer::CFX_BitmapComposer() {
m_BlendType = FXDIB_BLEND_NORMAL;
}
CFX_BitmapComposer::~CFX_BitmapComposer() {
- if (m_pScanlineV) {
- FX_Free(m_pScanlineV);
- }
- if (m_pScanlineAlphaV) {
- FX_Free(m_pScanlineAlphaV);
- }
- if (m_pClipScanV) {
- FX_Free(m_pClipScanV);
- }
- if (m_pAddClipScan) {
- FX_Free(m_pAddClipScan);
- }
+ FX_Free(m_pScanlineV);
+ FX_Free(m_pScanlineAlphaV);
+ FX_Free(m_pClipScanV);
+ FX_Free(m_pAddClipScan);
}
void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest,
const CFX_ClipRgn* pClipRgn,
diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp
index 74818f4a1b..4b50a0cdf3 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;
@@ -1135,9 +1123,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;
}
@@ -1215,24 +1201,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);
diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp
index a91d99d935..7443926df4 100644
--- a/core/src/fxge/dib/fx_dib_engine.cpp
+++ b/core/src/fxge/dib/fx_dib_engine.cpp
@@ -16,10 +16,8 @@ void CWeightTable::Calc(int dest_len,
int src_min,
int src_max,
int flags) {
- if (m_pWeightTables) {
- FX_Free(m_pWeightTables);
- m_pWeightTables = NULL;
- }
+ FX_Free(m_pWeightTables);
+ m_pWeightTables = NULL;
double scale, base;
scale = FXSYS_Div((FX_FLOAT)(src_len), (FX_FLOAT)(dest_len));
if (dest_len < 0) {
@@ -334,18 +332,10 @@ FX_BOOL CStretchEngine::Continue(IFX_Pause* pPause) {
return FALSE;
}
CStretchEngine::~CStretchEngine() {
- if (m_pDestScanline) {
- FX_Free(m_pDestScanline);
- }
- if (m_pInterBuf) {
- FX_Free(m_pInterBuf);
- }
- if (m_pExtraAlphaBuf) {
- FX_Free(m_pExtraAlphaBuf);
- }
- if (m_pDestMaskScanline) {
- FX_Free(m_pDestMaskScanline);
- }
+ FX_Free(m_pDestScanline);
+ FX_Free(m_pInterBuf);
+ FX_Free(m_pExtraAlphaBuf);
+ FX_Free(m_pDestMaskScanline);
}
FX_BOOL CStretchEngine::StartStretchHorz() {
if (m_DestWidth == 0 || m_pDestScanline == NULL ||
@@ -769,13 +759,9 @@ CFX_ImageStretcher::CFX_ImageStretcher() {
m_pMaskScanline = NULL;
}
CFX_ImageStretcher::~CFX_ImageStretcher() {
- if (m_pScanline) {
- FX_Free(m_pScanline);
- }
+ FX_Free(m_pScanline);
delete m_pStretchEngine;
- if (m_pMaskScanline) {
- FX_Free(m_pMaskScanline);
- }
+ FX_Free(m_pMaskScanline);
}
FXDIB_Format _GetStretchedFormat(const CFX_DIBSource* pSrc) {
FXDIB_Format format = pSrc->GetFormat();
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;