summaryrefslogtreecommitdiff
path: root/core/src/fxge/ge
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxge/ge')
-rw-r--r--core/src/fxge/ge/fx_ge.cpp2
-rw-r--r--core/src/fxge/ge/fx_ge_device.cpp2
-rw-r--r--core/src/fxge/ge/fx_ge_font.cpp8
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp33
-rw-r--r--core/src/fxge/ge/fx_ge_path.cpp4
-rw-r--r--core/src/fxge/ge/fx_ge_ps.cpp10
-rw-r--r--core/src/fxge/ge/fx_ge_text.cpp22
7 files changed, 39 insertions, 42 deletions
diff --git a/core/src/fxge/ge/fx_ge.cpp b/core/src/fxge/ge/fx_ge.cpp
index 138f81840e..f7787cf22c 100644
--- a/core/src/fxge/ge/fx_ge.cpp
+++ b/core/src/fxge/ge/fx_ge.cpp
@@ -41,7 +41,7 @@ void CFX_GEModule::Destroy() {
g_pGEModule = NULL;
}
CFX_FontCache* CFX_GEModule::GetFontCache() {
- if (m_pFontCache == NULL) {
+ if (!m_pFontCache) {
m_pFontCache = new CFX_FontCache();
}
return m_pFontCache;
diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp
index 37204268f2..268001b285 100644
--- a/core/src/fxge/ge/fx_ge_device.cpp
+++ b/core/src/fxge/ge/fx_ge_device.cpp
@@ -130,7 +130,7 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData,
if ((fill_mode & 3) == 0) {
fill_alpha = 0;
}
- if (pGraphState == NULL) {
+ if (!pGraphState) {
stroke_alpha = 0;
}
if (stroke_alpha == 0 && pPathData->GetPointCount() == 2) {
diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp
index 92dbf3adeb..4c0cef40c4 100644
--- a/core/src/fxge/ge/fx_ge_font.cpp
+++ b/core/src/fxge/ge/fx_ge_font.cpp
@@ -373,7 +373,7 @@ FX_BOOL CFX_Font::IsFixedWidth() const {
}
CFX_WideString CFX_Font::GetPsName() const {
- if (m_Face == NULL) {
+ if (!m_Face) {
return CFX_WideString();
}
CFX_WideString psName =
@@ -384,7 +384,7 @@ CFX_WideString CFX_Font::GetPsName() const {
return psName;
}
CFX_ByteString CFX_Font::GetFamilyName() const {
- if (m_Face == NULL && m_pSubstFont == NULL) {
+ if (!m_Face && !m_pSubstFont) {
return CFX_ByteString();
}
if (m_Face) {
@@ -393,7 +393,7 @@ CFX_ByteString CFX_Font::GetFamilyName() const {
return m_pSubstFont->m_Family;
}
CFX_ByteString CFX_Font::GetFaceName() const {
- if (m_Face == NULL && m_pSubstFont == NULL) {
+ if (!m_Face && !m_pSubstFont) {
return CFX_ByteString();
}
if (m_Face) {
@@ -411,7 +411,7 @@ CFX_ByteString CFX_Font::GetFaceName() const {
return m_pSubstFont->m_Family;
}
FX_BOOL CFX_Font::GetBBox(FX_RECT& bbox) {
- if (m_Face == NULL) {
+ if (!m_Face) {
return FALSE;
}
int em = FXFT_Get_Face_UnitsPerEM(m_Face);
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index dfd6704fe1..7f5dbe0ce7 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -315,10 +315,7 @@ CFX_ByteString GetFontFamily(CFX_ByteString fontName, int nStyle) {
fontName.c_str(), g_AltFontFamilies,
sizeof g_AltFontFamilies / sizeof(AltFontFamily), sizeof(AltFontFamily),
CompareFontFamilyString);
- if (found == NULL) {
- return fontName;
- }
- return found->m_pFontFamily;
+ return found ? CFX_ByteString(found->m_pFontFamily) : fontName;
}
CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) {
@@ -679,7 +676,7 @@ CFX_FontMapper::~CFX_FontMapper() {
}
}
void CFX_FontMapper::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) {
- if (pFontInfo == NULL) {
+ if (!pFontInfo) {
return;
}
if (m_pFontInfo) {
@@ -721,7 +718,7 @@ CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) {
}
void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) {
- if (m_pFontInfo == NULL) {
+ if (!m_pFontInfo) {
return;
}
if (m_CharsetArray.Find((FX_DWORD)charset) == -1) {
@@ -740,11 +737,11 @@ void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) {
}
if (bLocalized) {
void* hFont = m_pFontInfo->GetFont(name);
- if (hFont == NULL) {
+ if (!hFont) {
int iExact;
hFont =
m_pFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0, name, iExact);
- if (hFont == NULL) {
+ if (!hFont) {
return;
}
}
@@ -759,7 +756,7 @@ void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) {
m_LastFamily = name;
}
void CFX_FontMapper::LoadInstalledFonts() {
- if (m_pFontInfo == NULL) {
+ if (!m_pFontInfo) {
return;
}
if (m_bListLoaded) {
@@ -1019,7 +1016,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
Charset == FXFONT_CHINESEBIG5_CHARSET) {
bCJK = TRUE;
}
- if (m_pFontInfo == NULL) {
+ if (!m_pFontInfo) {
pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight,
PitchFamily);
@@ -1088,7 +1085,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
if (iExact) {
pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT;
}
- if (hFont == NULL) {
+ if (!hFont) {
#ifdef PDF_ENABLE_XFA
if (flags & FXFONT_EXACTMATCH) {
return NULL;
@@ -1104,7 +1101,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
}
if (!match.IsEmpty()) {
hFont = m_pFontInfo->GetFont(match);
- if (hFont == NULL) {
+ if (!hFont) {
return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight,
PitchFamily);
}
@@ -1168,7 +1165,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
uint8_t* pFontData;
face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum,
ttc_size - font_size, pFontData);
- if (face == NULL) {
+ if (!face) {
pFontData = FX_Alloc(uint8_t, ttc_size);
m_pFontInfo->GetFontData(hFont, kTableTTCF, pFontData, ttc_size);
face = m_pFontMgr->AddCachedTTCFace(ttc_size, checksum, pFontData,
@@ -1177,7 +1174,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
} else {
uint8_t* pFontData;
face = m_pFontMgr->GetCachedFace(SubstName, weight, bItalic, pFontData);
- if (face == NULL) {
+ if (!face) {
pFontData = FX_Alloc(uint8_t, font_size);
m_pFontInfo->GetFontData(hFont, 0, pFontData, font_size);
face = m_pFontMgr->AddCachedFace(SubstName, weight, bItalic, pFontData,
@@ -1185,7 +1182,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
m_pFontInfo->GetFaceIndex(hFont));
}
}
- if (face == NULL) {
+ if (!face) {
m_pFontInfo->DeleteFont(hFont);
return NULL;
}
@@ -1337,7 +1334,7 @@ FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) {
}
void CFX_FolderFontInfo::ScanPath(CFX_ByteString& path) {
void* handle = FX_OpenFolder(path);
- if (handle == NULL) {
+ if (!handle) {
return;
}
CFX_ByteString filename;
@@ -1371,7 +1368,7 @@ void CFX_FolderFontInfo::ScanPath(CFX_ByteString& path) {
}
void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) {
FXSYS_FILE* pFile = FXSYS_fopen(path, "rb");
- if (pFile == NULL) {
+ if (!pFile) {
return;
}
FXSYS_fseek(pFile, 0, FXSYS_SEEK_END);
@@ -1582,7 +1579,7 @@ FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont,
void CFX_FolderFontInfo::DeleteFont(void* hFont) {}
FX_BOOL CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
- if (hFont == NULL) {
+ if (!hFont) {
return FALSE;
}
CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont;
diff --git a/core/src/fxge/ge/fx_ge_path.cpp b/core/src/fxge/ge/fx_ge_path.cpp
index 543c33ba14..23b1c2fe07 100644
--- a/core/src/fxge/ge/fx_ge_path.cpp
+++ b/core/src/fxge/ge/fx_ge_path.cpp
@@ -384,7 +384,7 @@ CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width,
return rect;
}
void CFX_PathData::Transform(const CFX_Matrix* pMatrix) {
- if (pMatrix == NULL) {
+ if (!pMatrix) {
return;
}
for (int i = 0; i < m_PointCount; i++) {
@@ -564,7 +564,7 @@ FX_BOOL CFX_PathData::IsRect() const {
}
FX_BOOL CFX_PathData::IsRect(const CFX_Matrix* pMatrix,
CFX_FloatRect* pRect) const {
- if (pMatrix == NULL) {
+ if (!pMatrix) {
if (!IsRect()) {
return FALSE;
}
diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp
index ceb2acf2bc..f9fd8dea30 100644
--- a/core/src/fxge/ge/fx_ge_ps.cpp
+++ b/core/src/fxge/ge/fx_ge_ps.cpp
@@ -374,7 +374,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
int width = pSource->GetWidth();
int height = pSource->GetHeight();
buf << width << " " << height;
- if (pSource->GetBPP() == 1 && pSource->GetPalette() == NULL) {
+ if (pSource->GetBPP() == 1 && !pSource->GetPalette()) {
int pitch = (width + 7) / 8;
FX_DWORD src_size = height * pitch;
uint8_t* src_buf = FX_Alloc(uint8_t, src_size);
@@ -433,7 +433,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
break;
}
}
- if (pConverted == NULL) {
+ if (!pConverted) {
OUTPUT_PS("\nQ\n");
return FALSE;
}
@@ -449,7 +449,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
filter = "/DCTDecode filter ";
}
}
- if (filter == NULL) {
+ if (!filter) {
int src_pitch = width * Bpp;
output_size = height * src_pitch;
output_buf = FX_Alloc(uint8_t, output_size);
@@ -603,7 +603,7 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache,
matrix.Concat(1.0f, 0, 0, 1.0f, 0, 0);
const CFX_PathData* pPathData = pFaceCache->LoadGlyphPath(
pFont, charpos.m_GlyphIndex, charpos.m_FontCharWidth);
- if (pPathData == NULL) {
+ if (!pPathData) {
return;
}
CFX_PathData TransformedPath(*pPathData);
@@ -663,7 +663,7 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars,
buf << "q[" << pObject2Device->a << " " << pObject2Device->b << " "
<< pObject2Device->c << " " << pObject2Device->d << " "
<< pObject2Device->e << " " << pObject2Device->f << "]cm\n";
- if (pCache == NULL) {
+ if (!pCache) {
pCache = CFX_GEModule::Get()->GetFontCache();
}
CFX_FaceCache* pFaceCache = pCache->GetCachedFace(pFont);
diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp
index cd6b690a12..0ed0bbbbd6 100644
--- a/core/src/fxge/ge/fx_ge_text.cpp
+++ b/core/src/fxge/ge/fx_ge_text.cpp
@@ -51,7 +51,7 @@ FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos,
for (int iChar = 0; iChar < nChars; iChar++) {
FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[iChar];
const CFX_GlyphBitmap* pGlyph = glyph.m_pGlyph;
- if (pGlyph == NULL) {
+ if (!pGlyph) {
continue;
}
int char_left = glyph.m_OriginX + pGlyph->m_Left;
@@ -141,7 +141,7 @@ void _Color2Argb(FX_ARGB& argb,
FX_DWORD color,
int alpha_flag,
void* pIccTransform) {
- if (pIccTransform == NULL && !FXGETFLAG_COLORTYPE(alpha_flag)) {
+ if (!pIccTransform && !FXGETFLAG_COLORTYPE(alpha_flag)) {
argb = color;
return;
}
@@ -243,7 +243,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
if ((text_flags & FXTEXT_NOSMOOTH) == 0) {
if (m_DeviceClass == FXDC_DISPLAY && m_bpp > 1) {
FX_BOOL bClearType;
- if (pFont->GetFace() == NULL &&
+ if (!pFont->GetFace() &&
!(pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_CLEARTYPE)) {
bClearType = FALSE;
} else {
@@ -264,7 +264,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
}
}
}
- if (pCache == NULL) {
+ if (!pCache) {
pCache = CFX_GEModule::Get()->GetFontCache();
}
CFX_FaceCache* pFaceCache = pCache->GetCachedFace(pFont);
@@ -335,7 +335,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
bitmap.Clear(0);
for (iChar = 0; iChar < nChars; iChar++) {
FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[iChar];
- if (glyph.m_pGlyph == NULL) {
+ if (!glyph.m_pGlyph) {
continue;
}
const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap;
@@ -385,7 +385,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
}
for (iChar = 0; iChar < nChars; iChar++) {
FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[iChar];
- if (glyph.m_pGlyph == NULL) {
+ if (!glyph.m_pGlyph) {
continue;
}
const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap;
@@ -1118,7 +1118,7 @@ FX_BOOL CFX_RenderDevice::DrawTextPath(int nChars,
int alpha_flag,
void* pIccTransform,
int blend_type) {
- if (pCache == NULL) {
+ if (!pCache) {
pCache = CFX_GEModule::Get()->GetFontCache();
}
CFX_FaceCache* pFaceCache = pCache->GetCachedFace(pFont);
@@ -1133,7 +1133,7 @@ FX_BOOL CFX_RenderDevice::DrawTextPath(int nChars,
charpos.m_OriginY);
const CFX_PathData* pPath = pFaceCache->LoadGlyphPath(
pFont, charpos.m_GlyphIndex, charpos.m_FontCharWidth);
- if (pPath == NULL) {
+ if (!pPath) {
continue;
}
matrix.Concat(*pText2User);
@@ -1378,7 +1378,7 @@ CFX_SizeGlyphCache::~CFX_SizeGlyphCache() {
void CFX_Font::AdjustMMParams(int glyph_index, int dest_width, int weight) {
FXFT_MM_Var pMasters = NULL;
FXFT_Get_MM_Var(m_Face, &pMasters);
- if (pMasters == NULL) {
+ if (!pMasters) {
return;
}
long coords[2];
@@ -1511,7 +1511,7 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont,
const CFX_Matrix* pMatrix,
int dest_width,
int anti_alias) {
- if (m_Face == NULL) {
+ if (!m_Face) {
return NULL;
}
FXFT_Matrix ft_matrix;
@@ -1787,7 +1787,7 @@ static int _Outline_CubicTo(const FXFT_Vector* control1,
}
};
CFX_PathData* CFX_Font::LoadGlyphPath(FX_DWORD glyph_index, int dest_width) {
- if (m_Face == NULL) {
+ if (!m_Face) {
return NULL;
}
FXFT_Set_Pixel_Sizes(m_Face, 0, 64);