summaryrefslogtreecommitdiff
path: root/core/src/fxge
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxge')
-rw-r--r--core/src/fxge/android/fpf_skiafontmgr.h20
-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
-rw-r--r--core/src/fxge/ge/fx_ge_font.cpp18
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp4
-rw-r--r--core/src/fxge/ge/fx_ge_path.cpp25
-rw-r--r--core/src/fxge/ge/fx_ge_ps.cpp4
-rw-r--r--core/src/fxge/win32/fx_win32_device.cpp4
-rw-r--r--core/src/fxge/win32/fx_win32_print.cpp4
12 files changed, 54 insertions, 149 deletions
diff --git a/core/src/fxge/android/fpf_skiafontmgr.h b/core/src/fxge/android/fpf_skiafontmgr.h
index 17bcb48ca1..0b33627cf3 100644
--- a/core/src/fxge/android/fpf_skiafontmgr.h
+++ b/core/src/fxge/android/fpf_skiafontmgr.h
@@ -24,18 +24,12 @@ class CFPF_SkiaFontDescriptor {
m_iFaceIndex(0),
m_dwCharsets(0),
m_iGlyphNum(0) {}
- virtual ~CFPF_SkiaFontDescriptor() {
- if (m_pFamily) {
- FX_Free(m_pFamily);
- }
- }
+ virtual ~CFPF_SkiaFontDescriptor() { FX_Free(m_pFamily); }
virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Unknown; }
void SetFamily(const FX_CHAR* pFamily) {
- if (m_pFamily) {
- FX_Free(m_pFamily);
- }
+ FX_Free(m_pFamily);
int32_t iSize = FXSYS_strlen(pFamily);
m_pFamily = FX_Alloc(FX_CHAR, iSize + 1);
FXSYS_memcpy(m_pFamily, pFamily, iSize * sizeof(FX_CHAR));
@@ -51,19 +45,13 @@ class CFPF_SkiaFontDescriptor {
class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor {
public:
CFPF_SkiaPathFont() : m_pPath(NULL) {}
- ~CFPF_SkiaPathFont() override {
- if (m_pPath) {
- FX_Free(m_pPath);
- }
- }
+ ~CFPF_SkiaPathFont() override { FX_Free(m_pPath); }
// CFPF_SkiaFontDescriptor
int32_t GetType() const override { return FPF_SKIAFONTTYPE_Path; }
void SetPath(const FX_CHAR* pPath) {
- if (m_pPath) {
- FX_Free(m_pPath);
- }
+ FX_Free(m_pPath);
int32_t iSize = FXSYS_strlen(pPath);
m_pPath = FX_Alloc(FX_CHAR, iSize + 1);
FXSYS_memcpy(m_pPath, pPath, iSize * sizeof(FX_CHAR));
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;
diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp
index e701ee9492..8be177ed14 100644
--- a/core/src/fxge/ge/fx_ge_font.cpp
+++ b/core/src/fxge/ge/fx_ge_font.cpp
@@ -30,10 +30,8 @@ CFX_Font::CFX_Font() {
CFX_Font::~CFX_Font() {
delete m_pSubstFont;
m_pSubstFont = NULL;
- if (m_pFontDataAllocation) {
- FX_Free(m_pFontDataAllocation);
- m_pFontDataAllocation = NULL;
- }
+ FX_Free(m_pFontDataAllocation);
+ m_pFontDataAllocation = NULL;
if (m_Face) {
if (FXFT_Get_Face_External_Stream(m_Face)) {
FXFT_Clear_Face_External_Stream(m_Face);
@@ -44,14 +42,10 @@ CFX_Font::~CFX_Font() {
CFX_GEModule::Get()->GetFontMgr()->ReleaseFace(m_Face);
}
}
- if (m_pOwnedStream) {
- FX_Free(m_pOwnedStream);
- m_pOwnedStream = NULL;
- }
- if (m_pGsubData) {
- FX_Free(m_pGsubData);
- m_pGsubData = NULL;
- }
+ FX_Free(m_pOwnedStream);
+ m_pOwnedStream = NULL;
+ FX_Free(m_pGsubData);
+ m_pGsubData = NULL;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
ReleasePlatformResource();
#endif
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index d4416d9487..100688c4e0 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -33,9 +33,7 @@ CTTFontDesc::~CTTFontDesc() {
FXFT_Done_Face(m_TTCFace.m_pFaces[i]);
}
}
- if (m_pFontData) {
- FX_Free(m_pFontData);
- }
+ FX_Free(m_pFontData);
}
FX_BOOL CTTFontDesc::ReleaseFace(FXFT_Face face) {
if (m_Type == 1) {
diff --git a/core/src/fxge/ge/fx_ge_path.cpp b/core/src/fxge/ge/fx_ge_path.cpp
index b50c271c20..9acbcabfbf 100644
--- a/core/src/fxge/ge/fx_ge_path.cpp
+++ b/core/src/fxge/ge/fx_ge_path.cpp
@@ -117,17 +117,12 @@ CFX_PathData::CFX_PathData() {
m_pPoints = NULL;
}
CFX_PathData::~CFX_PathData() {
- if (m_pPoints) {
- FX_Free(m_pPoints);
- }
+ FX_Free(m_pPoints);
}
void CFX_PathData::SetPointCount(int nPoints) {
m_PointCount = nPoints;
if (m_AllocCount < nPoints) {
- if (m_pPoints) {
- FX_Free(m_pPoints);
- m_pPoints = NULL;
- }
+ FX_Free(m_pPoints);
m_pPoints = FX_Alloc(FX_PATHPOINT, nPoints);
m_AllocCount = nPoints;
}
@@ -138,9 +133,7 @@ void CFX_PathData::AllocPointCount(int nPoints) {
if (m_PointCount) {
FXSYS_memcpy(pNewBuf, m_pPoints, m_PointCount * sizeof(FX_PATHPOINT));
}
- if (m_pPoints) {
- FX_Free(m_pPoints);
- }
+ FX_Free(m_pPoints);
m_pPoints = pNewBuf;
m_AllocCount = nPoints;
}
@@ -640,9 +633,7 @@ CFX_GraphStateData::CFX_GraphStateData(const CFX_GraphStateData& src) {
void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) {
m_LineCap = src.m_LineCap;
m_DashCount = src.m_DashCount;
- if (m_DashArray) {
- FX_Free(m_DashArray);
- }
+ FX_Free(m_DashArray);
m_DashArray = NULL;
m_DashPhase = src.m_DashPhase;
m_LineJoin = src.m_LineJoin;
@@ -654,14 +645,10 @@ void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) {
}
}
CFX_GraphStateData::~CFX_GraphStateData() {
- if (m_DashArray) {
- FX_Free(m_DashArray);
- }
+ FX_Free(m_DashArray);
}
void CFX_GraphStateData::SetDashCount(int count) {
- if (m_DashArray) {
- FX_Free(m_DashArray);
- }
+ FX_Free(m_DashArray);
m_DashArray = NULL;
m_DashCount = count;
if (count == 0) {
diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp
index d20825d458..dacec0455c 100644
--- a/core/src/fxge/ge/fx_ge_ps.cpp
+++ b/core/src/fxge/ge/fx_ge_ps.cpp
@@ -322,9 +322,7 @@ static void PSCompressData(int PSLevel,
output_size = dest_size;
} else {
filter = NULL;
- if (dest_buf) {
- FX_Free(dest_buf);
- }
+ FX_Free(dest_buf);
}
}
FX_BOOL CFX_PSRenderer::SetDIBits(const CFX_DIBSource* pSource,
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp
index 9dbad11492..2db35f7f68 100644
--- a/core/src/fxge/win32/fx_win32_device.cpp
+++ b/core/src/fxge/win32/fx_win32_device.cpp
@@ -699,9 +699,7 @@ static HPEN _CreatePen(const CFX_GraphStateData* pGraphState,
}
HPEN hPen = ExtCreatePen(PenStyle, (DWORD)FXSYS_ceil(width), &lb,
pGraphState->m_DashCount, (const DWORD*)pDash);
- if (pDash) {
- FX_Free(pDash);
- }
+ FX_Free(pDash);
return hPen;
}
static HBRUSH _CreateBrush(FX_DWORD argb) {
diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp
index 85f339b529..18fe1eb6fa 100644
--- a/core/src/fxge/win32/fx_win32_print.cpp
+++ b/core/src/fxge/win32/fx_win32_print.cpp
@@ -283,9 +283,7 @@ CPSOutput::CPSOutput(HDC hDC) {
m_pBuf = NULL;
}
CPSOutput::~CPSOutput() {
- if (m_pBuf) {
- FX_Free(m_pBuf);
- }
+ FX_Free(m_pBuf);
}
void CPSOutput::Init() {
m_pBuf = FX_Alloc(FX_CHAR, 1026);