summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/agg/fx_agg_driver.h2
-rw-r--r--core/fxge/android/fpf_skiafontmgr.cpp25
-rw-r--r--core/fxge/android/fpf_skiafontmgr.h8
-rw-r--r--core/fxge/android/fx_android_font.cpp2
-rw-r--r--core/fxge/apple/apple_int.h20
-rw-r--r--core/fxge/apple/fx_apple_platform.cpp16
-rw-r--r--core/fxge/apple/fx_mac_imp.cpp6
-rw-r--r--core/fxge/apple/fx_quartz_device.cpp67
-rw-r--r--core/fxge/dib/dib_int.h4
-rw-r--r--core/fxge/dib/fx_dib_convert.cpp38
-rw-r--r--core/fxge/dib/fx_dib_engine.cpp16
-rw-r--r--core/fxge/dib/fx_dib_main.cpp46
-rw-r--r--core/fxge/dib/fx_dib_transform.cpp4
-rw-r--r--core/fxge/freetype/fx_freetype.cpp2
-rw-r--r--core/fxge/ge/fx_ge.cpp18
-rw-r--r--core/fxge/ge/fx_ge_device.cpp8
-rw-r--r--core/fxge/ge/fx_ge_font.cpp34
-rw-r--r--core/fxge/ge/fx_ge_fontmap.cpp42
-rw-r--r--core/fxge/ge/fx_ge_linux.cpp6
-rw-r--r--core/fxge/ge/fx_ge_path.cpp12
-rw-r--r--core/fxge/ge/fx_ge_text.cpp24
-rw-r--r--core/fxge/ge/fx_text_int.h2
-rw-r--r--core/fxge/include/fx_dib.h62
-rw-r--r--core/fxge/include/fx_font.h2
-rw-r--r--core/fxge/include/fx_ge.h24
-rw-r--r--core/fxge/include/fx_ge_win32.h2
-rw-r--r--core/fxge/skia/fx_skia_device.h16
-rw-r--r--core/fxge/win32/dwrite_int.h2
-rw-r--r--core/fxge/win32/fx_win32_dib.cpp50
-rw-r--r--core/fxge/win32/fx_win32_dwrite.cpp50
-rw-r--r--core/fxge/win32/fx_win32_gdipext.cpp60
-rw-r--r--core/fxge/win32/win32_int.h6
32 files changed, 337 insertions, 339 deletions
diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h
index 3462b61bb2..2c4e292faf 100644
--- a/core/fxge/agg/fx_agg_driver.h
+++ b/core/fxge/agg/fx_agg_driver.h
@@ -79,7 +79,7 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
int left,
int top,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
FX_BOOL bDEdge = FALSE) override;
CFX_DIBitmap* GetBackDrop() override { return m_pOriDevice; }
FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
diff --git a/core/fxge/android/fpf_skiafontmgr.cpp b/core/fxge/android/fpf_skiafontmgr.cpp
index 3158f4ca52..8a8cc83fb7 100644
--- a/core/fxge/android/fpf_skiafontmgr.cpp
+++ b/core/fxge/android/fpf_skiafontmgr.cpp
@@ -218,7 +218,7 @@ static FX_BOOL FPF_SkiaMaybeArabic(const CFX_ByteStringC& bsFacename) {
bsName.MakeLower();
return bsName.Find("arabic") > -1;
}
-CFPF_SkiaFontMgr::CFPF_SkiaFontMgr() : m_bLoaded(FALSE), m_FTLibrary(NULL) {}
+CFPF_SkiaFontMgr::CFPF_SkiaFontMgr() : m_bLoaded(FALSE), m_FTLibrary(nullptr) {}
CFPF_SkiaFontMgr::~CFPF_SkiaFontMgr() {
for (const auto& pair : m_FamilyFonts) {
if (pair.second)
@@ -234,10 +234,9 @@ CFPF_SkiaFontMgr::~CFPF_SkiaFontMgr() {
}
}
FX_BOOL CFPF_SkiaFontMgr::InitFTLibrary() {
- if (!m_FTLibrary) {
+ if (!m_FTLibrary)
FXFT_Init_FreeType(&m_FTLibrary);
- }
- return m_FTLibrary != NULL;
+ return !!m_FTLibrary;
}
void CFPF_SkiaFontMgr::LoadSystemFonts() {
if (m_bLoaded) {
@@ -333,18 +332,18 @@ CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname,
}
pFont->Release();
}
- return NULL;
+ return nullptr;
}
FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead* pFileRead,
int32_t iFaceIndex) {
if (!pFileRead) {
- return NULL;
+ return nullptr;
}
if (pFileRead->GetSize() == 0) {
- return NULL;
+ return nullptr;
}
if (iFaceIndex < 0) {
- return NULL;
+ return nullptr;
}
FXFT_StreamRec streamRec;
FXSYS_memset(&streamRec, 0, sizeof(FXFT_StreamRec));
@@ -357,7 +356,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead* pFileRead,
args.stream = &streamRec;
FXFT_Face face;
if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) {
- return NULL;
+ return nullptr;
}
FXFT_Set_Pixel_Sizes(face, 0, 64);
return face;
@@ -365,10 +364,10 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead* pFileRead,
FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const CFX_ByteStringC& bsFile,
int32_t iFaceIndex) {
if (bsFile.IsEmpty()) {
- return NULL;
+ return nullptr;
}
if (iFaceIndex < 0) {
- return NULL;
+ return nullptr;
}
FXFT_Open_Args args;
args.flags = FT_OPEN_PATHNAME;
@@ -384,10 +383,10 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const uint8_t* pBuffer,
size_t szBuffer,
int32_t iFaceIndex) {
if (!pBuffer || szBuffer < 1) {
- return NULL;
+ return nullptr;
}
if (iFaceIndex < 0) {
- return NULL;
+ return nullptr;
}
FXFT_Open_Args args;
args.flags = FT_OPEN_MEMORY;
diff --git a/core/fxge/android/fpf_skiafontmgr.h b/core/fxge/android/fpf_skiafontmgr.h
index be3ea460da..ec27a7fb21 100644
--- a/core/fxge/android/fpf_skiafontmgr.h
+++ b/core/fxge/android/fpf_skiafontmgr.h
@@ -28,7 +28,7 @@ class CFPF_SkiaFont;
class CFPF_SkiaFontDescriptor {
public:
CFPF_SkiaFontDescriptor()
- : m_pFamily(NULL),
+ : m_pFamily(nullptr),
m_dwStyle(0),
m_iFaceIndex(0),
m_dwCharsets(0),
@@ -53,7 +53,7 @@ class CFPF_SkiaFontDescriptor {
class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor {
public:
- CFPF_SkiaPathFont() : m_pPath(NULL) {}
+ CFPF_SkiaPathFont() : m_pPath(nullptr) {}
~CFPF_SkiaPathFont() override { FX_Free(m_pPath); }
// CFPF_SkiaFontDescriptor
@@ -71,7 +71,7 @@ class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor {
class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor {
public:
- CFPF_SkiaFileFont() : m_pFile(NULL) {}
+ CFPF_SkiaFileFont() : m_pFile(nullptr) {}
// CFPF_SkiaFontDescriptor
int32_t GetType() const override { return FPF_SKIAFONTTYPE_File; }
@@ -80,7 +80,7 @@ class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor {
class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor {
public:
- CFPF_SkiaBufferFont() : m_pBuffer(NULL), m_szBuffer(0) {}
+ CFPF_SkiaBufferFont() : m_pBuffer(nullptr), m_szBuffer(0) {}
// CFPF_SkiaFontDescriptor
int32_t GetType() const override { return FPF_SKIAFONTTYPE_Buffer; }
diff --git a/core/fxge/android/fx_android_font.cpp b/core/fxge/android/fx_android_font.cpp
index b1606bbd69..3246eb7f9e 100644
--- a/core/fxge/android/fx_android_font.cpp
+++ b/core/fxge/android/fx_android_font.cpp
@@ -12,7 +12,7 @@
#include "core/fxge/android/fpf_skiafontmgr.h"
#include "core/fxge/android/fx_android_font.h"
-CFX_AndroidFontInfo::CFX_AndroidFontInfo() : m_pFontMgr(NULL) {}
+CFX_AndroidFontInfo::CFX_AndroidFontInfo() : m_pFontMgr(nullptr) {}
FX_BOOL CFX_AndroidFontInfo::Init(CFPF_SkiaFontMgr* pFontMgr) {
if (!pFontMgr)
return FALSE;
diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h
index 1ef1f6c2b9..6afda63ee0 100644
--- a/core/fxge/apple/apple_int.h
+++ b/core/fxge/apple/apple_int.h
@@ -66,7 +66,7 @@ class CQuartz2D {
CGPoint* glyphPositions,
int32_t chars,
FX_ARGB argb,
- CFX_Matrix* matrix = NULL);
+ CFX_Matrix* matrix = nullptr);
void saveGraphicsState(void* graphics);
void restoreGraphicsState(void* graphics);
};
@@ -102,12 +102,12 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
uint32_t stroke_color,
int fill_mode,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) override;
FX_BOOL FillRect(const FX_RECT* pRect,
uint32_t fill_color,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) override;
FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
FX_FLOAT y1,
@@ -115,13 +115,13 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
FX_FLOAT y2,
uint32_t color,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) override;
FX_BOOL GetClipBox(FX_RECT* pRect) override;
FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
int left,
int top,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
FX_BOOL bDEdge = FALSE) override;
FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
@@ -130,7 +130,7 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
int dest_top,
int blend_type,
int alpha_flag = 0,
- void* pIccTransform = NULL) override;
+ void* pIccTransform = nullptr) override;
FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
int dest_left,
@@ -140,7 +140,7 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
const FX_RECT* pClipRect,
uint32_t flags,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) override;
FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
int bitmap_alpha,
@@ -149,7 +149,7 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
uint32_t flags,
void*& handle,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) override {
return FALSE;
}
@@ -161,7 +161,7 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
FX_FLOAT font_size,
uint32_t color,
int alpha_flag = 0,
- void* pIccTransform = NULL) override;
+ void* pIccTransform = nullptr) override;
void ClearDriver() override;
protected:
@@ -186,7 +186,7 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
int dest_top,
int dest_width,
int dest_height,
- CGRect* rect = NULL);
+ CGRect* rect = nullptr);
CGContextRef m_context;
CGAffineTransform m_foxitDevice2User;
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index 7bedc678ac..b25bb5875d 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -31,7 +31,7 @@ void CFX_AggDeviceDriver::DestroyPlatform() {
->m_quartz2d;
if (m_pPlatformGraphics) {
quartz2d.destroyGraphics(m_pPlatformGraphics);
- m_pPlatformGraphics = NULL;
+ m_pPlatformGraphics = nullptr;
}
}
void CFX_FaceCache::InitPlatform() {}
@@ -42,7 +42,7 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph_Nativetext(
const CFX_Matrix* pMatrix,
int dest_width,
int anti_alias) {
- return NULL;
+ return nullptr;
}
static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext,
int nChars,
@@ -100,7 +100,7 @@ static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext,
quartz2d.setGraphicsTextMatrix(pContext, &new_matrix);
return quartz2d.drawGraphicsString(pContext, pFont->GetPlatformFont(),
font_size, glyph_indices, glyph_positions,
- nChars, argb, NULL);
+ nChars, argb, nullptr);
}
static void _DoNothing(void* info, const void* data, size_t size) {}
FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars,
@@ -127,13 +127,13 @@ FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars,
}
}
CGContextRef ctx = CGContextRef(m_pPlatformGraphics);
- if (NULL == ctx) {
+ if (!ctx)
return FALSE;
- }
+
CGContextSaveGState(ctx);
CGContextSetTextDrawingMode(ctx, kCGTextFillClip);
CGRect rect_cg;
- CGImageRef pImageCG = NULL;
+ CGImageRef pImageCG = nullptr;
if (m_pClipRgn) {
rect_cg =
CGRectMake(m_pClipRgn->GetBox().left, m_pClipRgn->GetBox().top,
@@ -141,7 +141,7 @@ FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars,
const CFX_DIBitmap* pClipMask = m_pClipRgn->GetMask();
if (pClipMask) {
CGDataProviderRef pClipMaskDataProvider = CGDataProviderCreateWithData(
- NULL, pClipMask->GetBuffer(),
+ nullptr, pClipMask->GetBuffer(),
pClipMask->GetPitch() * pClipMask->GetHeight(), _DoNothing);
CGFloat decode_f[2] = {255.f, 0.f};
pImageCG = CGImageMaskCreate(
@@ -173,7 +173,7 @@ void CFX_Font::ReleasePlatformResource() {
static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData())
->m_quartz2d;
quartz2d.DestroyFont(m_pPlatformFont);
- m_pPlatformFont = NULL;
+ m_pPlatformFont = nullptr;
}
}
diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp
index 16dd4aef66..a0f2acb370 100644
--- a/core/fxge/apple/fx_mac_imp.cpp
+++ b/core/fxge/apple/fx_mac_imp.cpp
@@ -74,7 +74,7 @@ void* CFX_MacFontInfo::MapFont(int weight,
return GetFont("Courier New");
}
if (charset == FXFONT_ANSI_CHARSET || charset == FXFONT_SYMBOL_CHARSET) {
- return NULL;
+ return nullptr;
}
switch (charset) {
case FXFONT_SHIFTJIS_CHARSET:
@@ -93,7 +93,7 @@ void* CFX_MacFontInfo::MapFont(int weight,
if (it != m_FontList.end())
return it->second;
- return NULL;
+ return nullptr;
}
std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault(
@@ -111,6 +111,6 @@ void CFX_GEModule::InitPlatform() {
}
void CFX_GEModule::DestroyPlatform() {
delete (CApplePlatform*)m_pPlatformData;
- m_pPlatformData = NULL;
+ m_pPlatformData = nullptr;
}
#endif
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp
index 6fc22ffdf4..154910b69f 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -24,7 +24,7 @@
void* CQuartz2D::createGraphics(CFX_DIBitmap* pBitmap) {
if (!pBitmap) {
- return NULL;
+ return nullptr;
}
CGBitmapInfo bmpInfo = kCGBitmapByteOrder32Little;
switch (pBitmap->GetFormat()) {
@@ -33,7 +33,7 @@ void* CQuartz2D::createGraphics(CFX_DIBitmap* pBitmap) {
break;
case FXDIB_Argb:
default:
- return NULL;
+ return nullptr;
}
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(
@@ -48,11 +48,11 @@ void CQuartz2D::destroyGraphics(void* graphics) {
}
}
void* CQuartz2D::CreateFont(const uint8_t* pFontData, uint32_t dwFontSize) {
- CGDataProviderRef pDataProvider =
- CGDataProviderCreateWithData(NULL, pFontData, (size_t)dwFontSize, NULL);
- if (NULL == pDataProvider) {
- return NULL;
- }
+ CGDataProviderRef pDataProvider = CGDataProviderCreateWithData(
+ nullptr, pFontData, (size_t)dwFontSize, nullptr);
+ if (!pDataProvider)
+ return nullptr;
+
CGFontRef pCGFont = CGFontCreateWithDataProvider(pDataProvider);
CGDataProviderRelease(pDataProvider);
return pCGFont;
@@ -124,7 +124,7 @@ void CQuartz2D::restoreGraphicsState(void* graphics) {
}
static CGContextRef createContextWithBitmap(CFX_DIBitmap* pBitmap) {
if (!pBitmap || pBitmap->IsCmykImage() || pBitmap->GetBPP() < 32) {
- return NULL;
+ return nullptr;
}
CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Little;
if (pBitmap->HasAlpha()) {
@@ -476,9 +476,9 @@ FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap,
pt.x *= FXSYS_fabs(ctm.a);
pt.y *= FXSYS_fabs(ctm.d);
CGImageRef image = CGBitmapContextCreateImage(m_context);
- if (NULL == image) {
+ if (!image)
return FALSE;
- }
+
CGFloat width = (CGFloat)bitmap->GetWidth();
CGFloat height = (CGFloat)bitmap->GetHeight();
if (width + pt.x > m_width) {
@@ -547,26 +547,26 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
CGSizeMake(pBitmap->GetWidth() / scale_x, pBitmap->GetHeight() / scale_y);
rect_usr = CGRectOffset(rect_usr, -src_left, -src_top);
CG_SetImageTransform(dest_left, dest_top, src_width, src_height, &rect_usr);
- CFX_DIBitmap* pBitmap1 = NULL;
+ CFX_DIBitmap* pBitmap1 = nullptr;
if (pBitmap->IsAlphaMask()) {
if (pBitmap->GetBuffer()) {
pBitmap1 = (CFX_DIBitmap*)pBitmap;
} else {
pBitmap1 = pBitmap->Clone();
}
- if (NULL == pBitmap1) {
+ if (!pBitmap1) {
RestoreState(false);
return FALSE;
}
CGDataProviderRef pBitmapProvider = CGDataProviderCreateWithData(
- NULL, pBitmap1->GetBuffer(),
- pBitmap1->GetPitch() * pBitmap1->GetHeight(), NULL);
+ nullptr, pBitmap1->GetBuffer(),
+ pBitmap1->GetPitch() * pBitmap1->GetHeight(), nullptr);
CGColorSpaceRef pColorSpace = CGColorSpaceCreateDeviceGray();
CGBitmapInfo bitmapInfo = kCGImageAlphaNone | kCGBitmapByteOrderDefault;
CGImageRef pImage = CGImageCreate(
pBitmap1->GetWidth(), pBitmap1->GetHeight(), pBitmap1->GetBPP(),
pBitmap1->GetBPP(), pBitmap1->GetPitch(), pColorSpace, bitmapInfo,
- pBitmapProvider, NULL, true, kCGRenderingIntentDefault);
+ pBitmapProvider, nullptr, true, kCGRenderingIntentDefault);
CGContextClipToMask(m_context, rect_usr, pImage);
CGContextSetRGBFillColor(m_context, FXARGB_R(argb) / 255.f,
FXARGB_G(argb) / 255.f, FXARGB_B(argb) / 255.f,
@@ -590,7 +590,7 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
pBitmap1 = pBitmap->Clone();
}
}
- if (NULL == pBitmap1) {
+ if (!pBitmap1) {
RestoreState(false);
return FALSE;
}
@@ -665,26 +665,26 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
CGContextSetInterpolationQuality(m_context, kCGInterpolationMedium);
}
CG_SetImageTransform(dest_left, dest_top, dest_width, dest_height);
- CFX_DIBitmap* pBitmap1 = NULL;
+ CFX_DIBitmap* pBitmap1 = nullptr;
if (pBitmap->IsAlphaMask()) {
if (pBitmap->GetBuffer()) {
pBitmap1 = (CFX_DIBitmap*)pBitmap;
} else {
pBitmap1 = pBitmap->Clone();
}
- if (NULL == pBitmap1) {
+ if (!pBitmap1) {
RestoreState(false);
return FALSE;
}
CGDataProviderRef pBitmapProvider = CGDataProviderCreateWithData(
- NULL, pBitmap1->GetBuffer(),
- pBitmap1->GetPitch() * pBitmap1->GetHeight(), NULL);
+ nullptr, pBitmap1->GetBuffer(),
+ pBitmap1->GetPitch() * pBitmap1->GetHeight(), nullptr);
CGColorSpaceRef pColorSpace = CGColorSpaceCreateDeviceGray();
CGBitmapInfo bitmapInfo = kCGImageAlphaNone | kCGBitmapByteOrderDefault;
CGImageRef pImage = CGImageCreate(
pBitmap1->GetWidth(), pBitmap1->GetHeight(), pBitmap1->GetBPP(),
pBitmap1->GetBPP(), pBitmap1->GetPitch(), pColorSpace, bitmapInfo,
- pBitmapProvider, NULL, true, kCGRenderingIntentDefault);
+ pBitmapProvider, nullptr, true, kCGRenderingIntentDefault);
CGContextClipToMask(m_context, rect, pImage);
CGContextSetRGBFillColor(m_context, FXARGB_R(argb) / 255.f,
FXARGB_G(argb) / 255.f, FXARGB_B(argb) / 255.f,
@@ -708,7 +708,7 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
pBitmap1 = pBitmap->Clone();
}
}
- if (NULL == pBitmap1) {
+ if (!pBitmap1) {
RestoreState(false);
return FALSE;
}
@@ -817,7 +817,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
uint32_t color,
int alpha_flag,
void* pIccTransform) {
- if (NULL == pFont || NULL == m_context)
+ if (!pFont || !m_context)
return FALSE;
FX_BOOL bBold = pFont->IsBold();
if (!bBold && pFont->GetSubstFont() &&
@@ -832,8 +832,9 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
while (i < nChars) {
if (pCharPos[i].m_bGlyphAdjust || font_size < 0) {
if (i > 0) {
- ret = CG_DrawGlypRun(i, pCharPos, pFont, pCache, NULL, pObject2Device,
- font_size, color, alpha_flag, pIccTransform);
+ ret =
+ CG_DrawGlypRun(i, pCharPos, pFont, pCache, nullptr, pObject2Device,
+ font_size, color, alpha_flag, pIccTransform);
if (!ret) {
RestoreState(false);
return ret;
@@ -865,7 +866,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
}
}
if (i > 0) {
- ret = CG_DrawGlypRun(i, pCharPos, pFont, pCache, NULL, pObject2Device,
+ ret = CG_DrawGlypRun(i, pCharPos, pFont, pCache, nullptr, pObject2Device,
font_size, color, alpha_flag, pIccTransform);
}
RestoreState(false);
@@ -874,9 +875,9 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
void CFX_QuartzDeviceDriver::setStrokeInfo(const CFX_GraphStateData* graphState,
FX_ARGB argb,
FX_FLOAT lineWidth) {
- if (NULL == graphState) {
+ if (!graphState)
return;
- }
+
CGContextSetLineWidth(m_context, lineWidth);
CGLineCap cap;
switch (graphState->m_LineCap) {
@@ -989,9 +990,9 @@ void CFX_QuartzDeviceDriver::CG_SetImageTransform(int dest_left,
}
}
void CFX_QuartzDeviceDriver::ClearDriver() {
- if (NULL == m_context) {
+ if (!m_context)
return;
- }
+
for (int i = 0; i < m_saveCount; ++i) {
CGContextRestoreGState(m_context);
}
@@ -1002,7 +1003,7 @@ void CFX_QuartzDeviceDriver::ClearDriver() {
}
CFX_QuartzDevice::CFX_QuartzDevice() {
m_bOwnedBitmap = FALSE;
- m_pContext = NULL;
+ m_pContext = nullptr;
}
CFX_QuartzDevice::~CFX_QuartzDevice() {
if (m_pContext) {
@@ -1029,9 +1030,9 @@ FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, int32_t nDeviceClass) {
FX_BOOL CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap) {
SetBitmap(pBitmap);
m_pContext = createContextWithBitmap(pBitmap);
- if (NULL == m_pContext) {
+ if (!m_pContext)
return FALSE;
- }
+
IFX_RenderDeviceDriver* pDriver =
new CFX_QuartzDeviceDriver(m_pContext, FXDC_DISPLAY);
SetDeviceDriver(pDriver);
diff --git a/core/fxge/dib/dib_int.h b/core/fxge/dib/dib_int.h
index ebb1ddc0ed..415362d51d 100644
--- a/core/fxge/dib/dib_int.h
+++ b/core/fxge/dib/dib_int.h
@@ -42,10 +42,10 @@ struct PixelWeight {
};
class CWeightTable {
public:
- CWeightTable() { m_pWeightTables = NULL; }
+ CWeightTable() { m_pWeightTables = nullptr; }
~CWeightTable() {
FX_Free(m_pWeightTables);
- m_pWeightTables = NULL;
+ m_pWeightTables = nullptr;
}
void Calc(int dest_len,
int dest_min,
diff --git a/core/fxge/dib/fx_dib_convert.cpp b/core/fxge/dib/fx_dib_convert.cpp
index 8937816531..a1e6bb3e18 100644
--- a/core/fxge/dib/fx_dib_convert.cpp
+++ b/core/fxge/dib/fx_dib_convert.cpp
@@ -81,9 +81,9 @@ void _Obtain_Pal(uint32_t* aLut,
}
CFX_Palette::CFX_Palette() {
- m_pPalette = NULL;
- m_cLut = NULL;
- m_aLut = NULL;
+ m_pPalette = nullptr;
+ m_cLut = nullptr;
+ m_aLut = nullptr;
m_lut = 0;
}
CFX_Palette::~CFX_Palette() {
@@ -102,9 +102,9 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap) {
int width = pBitmap->GetWidth();
int height = pBitmap->GetHeight();
FX_Free(m_cLut);
- m_cLut = NULL;
+ m_cLut = nullptr;
FX_Free(m_aLut);
- m_aLut = NULL;
+ m_aLut = nullptr;
m_cLut = FX_Alloc(uint32_t, 4096);
m_aLut = FX_Alloc(uint32_t, 4096);
int row, col;
@@ -821,7 +821,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
FXDIB_Format src_format = pSrcBitmap->GetFormat();
if (!CFX_GEModule::Get()->GetCodecModule() ||
!CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) {
- pIccTransform = NULL;
+ pIccTransform = nullptr;
}
switch (dest_format) {
case FXDIB_Invalid:
@@ -958,26 +958,26 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format,
if (pClip) {
CFX_DIBitmap* pClone = Clone(pClip);
if (!pClone) {
- return NULL;
+ return nullptr;
}
if (!pClone->ConvertFormat(dest_format, pIccTransform)) {
delete pClone;
- return NULL;
+ return nullptr;
}
return pClone;
}
CFX_DIBitmap* pClone = new CFX_DIBitmap;
if (!pClone->Create(m_Width, m_Height, dest_format)) {
delete pClone;
- return NULL;
+ return nullptr;
}
FX_BOOL ret = TRUE;
- CFX_DIBitmap* pSrcAlpha = NULL;
+ CFX_DIBitmap* pSrcAlpha = nullptr;
if (HasAlpha()) {
pSrcAlpha = (GetFormat() == FXDIB_Argb) ? GetAlphaMask() : m_pAlphaMask;
if (!pSrcAlpha) {
delete pClone;
- return NULL;
+ return nullptr;
}
}
if (dest_format & 0x0200) {
@@ -990,24 +990,24 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format,
}
if (pSrcAlpha && pSrcAlpha != m_pAlphaMask) {
delete pSrcAlpha;
- pSrcAlpha = NULL;
+ pSrcAlpha = nullptr;
}
if (!ret) {
delete pClone;
- return NULL;
+ return nullptr;
}
- uint32_t* pal_8bpp = NULL;
+ uint32_t* pal_8bpp = nullptr;
ret = ConvertBuffer(dest_format, pClone->GetBuffer(), pClone->GetPitch(),
m_Width, m_Height, this, 0, 0, pal_8bpp, pIccTransform);
if (!ret) {
FX_Free(pal_8bpp);
delete pClone;
- return NULL;
+ return nullptr;
}
if (pal_8bpp) {
pClone->CopyPalette(pal_8bpp);
FX_Free(pal_8bpp);
- pal_8bpp = NULL;
+ pal_8bpp = nullptr;
}
return pClone;
}
@@ -1040,7 +1040,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format,
if (!dest_buf) {
return FALSE;
}
- CFX_DIBitmap* pAlphaMask = NULL;
+ CFX_DIBitmap* pAlphaMask = nullptr;
if (dest_format == FXDIB_Argb) {
FXSYS_memset(dest_buf, 0xff, dest_pitch * m_Height + 4);
if (m_pAlphaMask) {
@@ -1067,14 +1067,14 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format,
return FALSE;
}
pAlphaMask = m_pAlphaMask;
- m_pAlphaMask = NULL;
+ m_pAlphaMask = nullptr;
} else {
pAlphaMask = m_pAlphaMask;
}
}
}
FX_BOOL ret = FALSE;
- uint32_t* pal_8bpp = NULL;
+ uint32_t* pal_8bpp = nullptr;
ret = ConvertBuffer(dest_format, dest_buf, dest_pitch, m_Width, m_Height,
this, 0, 0, pal_8bpp, pIccTransform);
if (!ret) {
diff --git a/core/fxge/dib/fx_dib_engine.cpp b/core/fxge/dib/fx_dib_engine.cpp
index 3bdff23f1e..6df51d27c0 100644
--- a/core/fxge/dib/fx_dib_engine.cpp
+++ b/core/fxge/dib/fx_dib_engine.cpp
@@ -40,7 +40,7 @@ void CWeightTable::Calc(int dest_len,
int src_max,
int flags) {
FX_Free(m_pWeightTables);
- m_pWeightTables = NULL;
+ m_pWeightTables = nullptr;
double scale, base;
scale = (FX_FLOAT)src_len / (FX_FLOAT)dest_len;
if (dest_len < 0) {
@@ -249,9 +249,9 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap,
m_pDestBitmap = pDestBitmap;
m_DestWidth = dest_width;
m_DestHeight = dest_height;
- m_pInterBuf = NULL;
- m_pExtraAlphaBuf = NULL;
- m_pDestMaskScanline = NULL;
+ m_pInterBuf = nullptr;
+ m_pExtraAlphaBuf = nullptr;
+ m_pDestMaskScanline = nullptr;
m_DestClip = clip_rect;
uint32_t size = clip_rect.Width();
if (size && m_DestBpp > (int)(INT_MAX / size)) {
@@ -272,7 +272,7 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap,
}
m_InterPitch = (m_DestClip.Width() * m_DestBpp + 31) / 32 * 4;
m_ExtraMaskPitch = (m_DestClip.Width() * 8 + 31) / 32 * 4;
- m_pInterBuf = NULL;
+ m_pInterBuf = nullptr;
m_pSource = pSrcBitmap;
m_SrcWidth = pSrcBitmap->GetWidth();
m_SrcHeight = pSrcBitmap->GetHeight();
@@ -408,8 +408,8 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) {
const uint8_t* src_scan = m_pSource->GetScanline(m_CurRow);
uint8_t* dest_scan =
m_pInterBuf + (m_CurRow - m_SrcClip.top) * m_InterPitch;
- const uint8_t* src_scan_mask = NULL;
- uint8_t* dest_scan_mask = NULL;
+ const uint8_t* src_scan_mask = nullptr;
+ uint8_t* dest_scan_mask = nullptr;
if (m_pExtraAlphaBuf) {
src_scan_mask = m_pSource->m_pAlphaMask->GetScanline(m_CurRow);
dest_scan_mask =
@@ -718,7 +718,7 @@ void CStretchEngine::StretchVert() {
for (int col = m_DestClip.left; col < m_DestClip.right; col++) {
unsigned char* src_scan =
m_pInterBuf + (col - m_DestClip.left) * DestBpp;
- unsigned char* src_scan_mask = NULL;
+ unsigned char* src_scan_mask = nullptr;
if (m_DestFormat != FXDIB_Argb) {
src_scan_mask = m_pExtraAlphaBuf + (col - m_DestClip.left);
}
diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp
index 896551401a..f4ea49b58f 100644
--- a/core/fxge/dib/fx_dib_main.cpp
+++ b/core/fxge/dib/fx_dib_main.cpp
@@ -48,8 +48,8 @@ CFX_DIBSource::CFX_DIBSource() {
m_AlphaFlag = 0;
m_Width = m_Height = 0;
m_Pitch = 0;
- m_pPalette = NULL;
- m_pAlphaMask = NULL;
+ m_pPalette = nullptr;
+ m_pAlphaMask = nullptr;
}
CFX_DIBSource::~CFX_DIBSource() {
@@ -58,7 +58,7 @@ CFX_DIBSource::~CFX_DIBSource() {
}
uint8_t* CFX_DIBSource::GetBuffer() const {
- return NULL;
+ return nullptr;
}
FX_BOOL CFX_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const {
@@ -67,8 +67,8 @@ FX_BOOL CFX_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const {
CFX_DIBitmap::CFX_DIBitmap() {
m_bExtBuf = FALSE;
- m_pBuffer = NULL;
- m_pPalette = NULL;
+ m_pBuffer = nullptr;
+ m_pPalette = nullptr;
}
#define _MAX_OOM_LIMIT_ 12000000
@@ -77,7 +77,7 @@ FX_BOOL CFX_DIBitmap::Create(int width,
FXDIB_Format format,
uint8_t* pBuffer,
int pitch) {
- m_pBuffer = NULL;
+ m_pBuffer = nullptr;
m_bpp = (uint8_t)format;
m_AlphaFlag = (uint8_t)(format >> 8);
m_Width = m_Height = m_Pitch = 0;
@@ -117,7 +117,7 @@ FX_BOOL CFX_DIBitmap::Create(int width,
if (!ret) {
if (!m_bExtBuf) {
FX_Free(m_pBuffer);
- m_pBuffer = NULL;
+ m_pBuffer = nullptr;
m_Width = m_Height = m_Pitch = 0;
return FALSE;
}
@@ -181,13 +181,13 @@ CFX_DIBitmap* CFX_DIBSource::Clone(const FX_RECT* pClip) const {
if (pClip) {
rect.Intersect(*pClip);
if (rect.IsEmpty()) {
- return NULL;
+ return nullptr;
}
}
CFX_DIBitmap* pNewBitmap = new CFX_DIBitmap;
if (!pNewBitmap->Create(rect.Width(), rect.Height(), GetFormat())) {
delete pNewBitmap;
- return NULL;
+ return nullptr;
}
pNewBitmap->CopyPalette(m_pPalette);
pNewBitmap->CopyAlphaMask(m_pAlphaMask, pClip);
@@ -249,7 +249,7 @@ FX_BOOL CFX_DIBSource::BuildAlphaMask() {
m_pAlphaMask = new CFX_DIBitmap;
if (!m_pAlphaMask->Create(m_Width, m_Height, FXDIB_8bppMask)) {
delete m_pAlphaMask;
- m_pAlphaMask = NULL;
+ m_pAlphaMask = nullptr;
return FALSE;
}
FXSYS_memset(m_pAlphaMask->GetBuffer(), 0xff,
@@ -410,7 +410,7 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left,
return FALSE;
}
GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(),
- pSrcBitmap->GetHeight(), src_left, src_top, NULL);
+ pSrcBitmap->GetHeight(), src_left, src_top, nullptr);
if (width == 0 || height == 0) {
return TRUE;
}
@@ -451,7 +451,7 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left,
}
uint8_t* dest_buf =
m_pBuffer + dest_top * m_Pitch + dest_left * GetBPP() / 8;
- uint32_t* d_plt = NULL;
+ uint32_t* d_plt = nullptr;
if (!ConvertBuffer(dest_format, dest_buf, m_Pitch, width, height,
pSrcBitmap, src_left, src_top, d_plt, pIccTransform)) {
return FALSE;
@@ -478,7 +478,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left,
return FALSE;
}
GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(),
- pMask->GetHeight(), src_left, src_top, NULL);
+ pMask->GetHeight(), src_left, src_top, nullptr);
if (width == 0 || height == 0) {
return TRUE;
}
@@ -571,7 +571,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left,
void CFX_DIBSource::CopyPalette(const uint32_t* pSrc, uint32_t size) {
if (!pSrc || GetBPP() > 8) {
FX_Free(m_pPalette);
- m_pPalette = NULL;
+ m_pPalette = nullptr;
} else {
uint32_t pal_size = 1 << GetBPP();
if (!m_pPalette) {
@@ -608,13 +608,13 @@ CFX_DIBitmap* CFX_DIBSource::GetAlphaMask(const FX_RECT* pClip) const {
if (pClip) {
rect.Intersect(*pClip);
if (rect.IsEmpty()) {
- return NULL;
+ return nullptr;
}
}
CFX_DIBitmap* pMask = new CFX_DIBitmap;
if (!pMask->Create(rect.Width(), rect.Height(), FXDIB_8bppMask)) {
delete pMask;
- return NULL;
+ return nullptr;
}
for (int row = rect.top; row < rect.bottom; row++) {
const uint8_t* src_scan = GetScanline(row) + rect.left * 4 + 3;
@@ -760,7 +760,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
}
}
if (pSrcClone != pSrcBitmap) {
- pSrcClone->m_pAlphaMask = NULL;
+ pSrcClone->m_pAlphaMask = nullptr;
delete pSrcClone;
}
pSrcClone = pAlphaMask;
@@ -1381,7 +1381,7 @@ CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const {
CFX_DIBitmap* pFlipped = new CFX_DIBitmap;
if (!pFlipped->Create(m_Width, m_Height, GetFormat())) {
delete pFlipped;
- return NULL;
+ return nullptr;
}
pFlipped->CopyPalette(m_pPalette);
uint8_t* pDestBuffer = pFlipped->GetBuffer();
@@ -1449,13 +1449,13 @@ CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const {
return pFlipped;
}
CFX_DIBExtractor::CFX_DIBExtractor(const CFX_DIBSource* pSrc) {
- m_pBitmap = NULL;
+ m_pBitmap = nullptr;
if (pSrc->GetBuffer()) {
m_pBitmap = new CFX_DIBitmap;
if (!m_pBitmap->Create(pSrc->GetWidth(), pSrc->GetHeight(),
pSrc->GetFormat(), pSrc->GetBuffer())) {
delete m_pBitmap;
- m_pBitmap = NULL;
+ m_pBitmap = nullptr;
return;
}
m_pBitmap->CopyPalette(pSrc->GetPalette());
@@ -1468,8 +1468,8 @@ CFX_DIBExtractor::~CFX_DIBExtractor() {
delete m_pBitmap;
}
CFX_FilteredDIB::CFX_FilteredDIB() {
- m_pScanline = NULL;
- m_pSrc = NULL;
+ m_pScanline = nullptr;
+ m_pSrc = nullptr;
}
CFX_FilteredDIB::~CFX_FilteredDIB() {
if (m_bAutoDropSrc) {
@@ -1506,7 +1506,7 @@ void CFX_FilteredDIB::DownSampleScanline(int line,
}
CFX_ImageRenderer::CFX_ImageRenderer() {
m_Status = 0;
- m_pTransformer = NULL;
+ m_pTransformer = nullptr;
m_bRgbByteOrder = FALSE;
m_BlendType = FXDIB_BLEND_NORMAL;
}
diff --git a/core/fxge/dib/fx_dib_transform.cpp b/core/fxge/dib/fx_dib_transform.cpp
index 914ca58013..82b9cf781f 100644
--- a/core/fxge/dib/fx_dib_transform.cpp
+++ b/core/fxge/dib/fx_dib_transform.cpp
@@ -182,13 +182,13 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip,
dest_clip.Intersect(*pDestClip);
}
if (dest_clip.IsEmpty()) {
- return NULL;
+ return nullptr;
}
CFX_DIBitmap* pTransBitmap = new CFX_DIBitmap;
int result_height = dest_clip.Height(), result_width = dest_clip.Width();
if (!pTransBitmap->Create(result_width, result_height, GetFormat())) {
delete pTransBitmap;
- return NULL;
+ return nullptr;
}
pTransBitmap->CopyPalette(m_pPalette);
int dest_pitch = pTransBitmap->GetPitch();
diff --git a/core/fxge/freetype/fx_freetype.cpp b/core/fxge/freetype/fx_freetype.cpp
index f60d0c64d0..295513d8b3 100644
--- a/core/fxge/freetype/fx_freetype.cpp
+++ b/core/fxge/freetype/fx_freetype.cpp
@@ -136,7 +136,7 @@ int FXFT_unicode_from_adobe_name(const char* glyph_name) {
/* find variants like `A.swash', `e.final', etc. */
{
const char* p = glyph_name;
- const char* dot = NULL;
+ const char* dot = nullptr;
for (; *p; p++) {
if (*p == '.' && p > glyph_name) {
diff --git a/core/fxge/ge/fx_ge.cpp b/core/fxge/ge/fx_ge.cpp
index 9e45dc7434..360a4eb417 100644
--- a/core/fxge/ge/fx_ge.cpp
+++ b/core/fxge/ge/fx_ge.cpp
@@ -8,20 +8,20 @@
#include "core/fxge/ge/fx_text_int.h"
-static CFX_GEModule* g_pGEModule = NULL;
+static CFX_GEModule* g_pGEModule = nullptr;
CFX_GEModule::CFX_GEModule(const char** pUserFontPaths) {
- m_pFontCache = NULL;
- m_pFontMgr = NULL;
- m_FTLibrary = NULL;
- m_pCodecModule = NULL;
- m_pPlatformData = NULL;
+ m_pFontCache = nullptr;
+ m_pFontMgr = nullptr;
+ m_FTLibrary = nullptr;
+ m_pCodecModule = nullptr;
+ m_pPlatformData = nullptr;
m_pUserFontPaths = pUserFontPaths;
}
CFX_GEModule::~CFX_GEModule() {
delete m_pFontCache;
- m_pFontCache = NULL;
+ m_pFontCache = nullptr;
delete m_pFontMgr;
- m_pFontMgr = NULL;
+ m_pFontMgr = nullptr;
DestroyPlatform();
}
CFX_GEModule* CFX_GEModule::Get() {
@@ -38,7 +38,7 @@ void CFX_GEModule::Use(CFX_GEModule* pModule) {
}
void CFX_GEModule::Destroy() {
delete g_pGEModule;
- g_pGEModule = NULL;
+ g_pGEModule = nullptr;
}
CFX_FontCache* CFX_GEModule::GetFontCache() {
if (!m_pFontCache) {
diff --git a/core/fxge/ge/fx_ge_device.cpp b/core/fxge/ge/fx_ge_device.cpp
index 96e0e55cd1..7763d91363 100644
--- a/core/fxge/ge/fx_ge_device.cpp
+++ b/core/fxge/ge/fx_ge_device.cpp
@@ -7,8 +7,8 @@
#include "core/fxge/include/fx_ge.h"
CFX_RenderDevice::CFX_RenderDevice() {
- m_pDeviceDriver = NULL;
- m_pBitmap = NULL;
+ m_pDeviceDriver = nullptr;
+ m_pBitmap = nullptr;
}
CFX_RenderDevice::~CFX_RenderDevice() {
delete m_pDeviceDriver;
@@ -193,7 +193,7 @@ FX_BOOL CFX_RenderDevice::DrawPathWithBlend(
if (bThin) {
strokecolor = (((fill_alpha >> 2) << 24) | (strokecolor & 0x00ffffff));
}
- CFX_Matrix* pMatrix = NULL;
+ CFX_Matrix* pMatrix = nullptr;
if (pObject2Device && !pObject2Device->IsIdentity()) {
pMatrix = (CFX_Matrix*)pObject2Device;
}
@@ -255,7 +255,7 @@ FX_BOOL CFX_RenderDevice::DrawFillStrokePath(
bitmap.Clear(0);
Backdrop.Copy(&bitmap);
} else {
- if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top, NULL)) {
+ if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top, nullptr)) {
return FALSE;
}
Backdrop.Copy(&bitmap);
diff --git a/core/fxge/ge/fx_ge_font.cpp b/core/fxge/ge/fx_ge_font.cpp
index ba53be7ab5..22b7aa38bf 100644
--- a/core/fxge/ge/fx_ge_font.cpp
+++ b/core/fxge/ge/fx_ge_font.cpp
@@ -39,30 +39,30 @@ FXFT_Face FT_LoadFont(const uint8_t* pData, int size) {
} // namespace
CFX_Font::CFX_Font() {
- m_pSubstFont = NULL;
- m_Face = NULL;
+ m_pSubstFont = nullptr;
+ m_Face = nullptr;
m_bEmbedded = FALSE;
m_bVertical = FALSE;
- m_pFontData = NULL;
- m_pFontDataAllocation = NULL;
+ m_pFontData = nullptr;
+ m_pFontDataAllocation = nullptr;
m_dwSize = 0;
- m_pGsubData = NULL;
- m_pPlatformFont = NULL;
- m_pPlatformFontCollection = NULL;
- m_pDwFont = NULL;
- m_hHandle = NULL;
+ m_pGsubData = nullptr;
+ m_pPlatformFont = nullptr;
+ m_pPlatformFontCollection = nullptr;
+ m_pDwFont = nullptr;
+ m_hHandle = nullptr;
m_bDwLoaded = FALSE;
#ifdef PDF_ENABLE_XFA
m_bLogic = FALSE;
- m_pOwnedStream = NULL;
+ m_pOwnedStream = nullptr;
#endif // PDF_ENABLE_XFA
}
#ifdef PDF_ENABLE_XFA
FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) {
- if (pFont == NULL) {
+ if (!pFont)
return FALSE;
- }
+
m_bLogic = TRUE;
if (pFont->m_pSubstFont) {
m_pSubstFont = new CFX_SubstFont;
@@ -124,7 +124,7 @@ CFX_Font::~CFX_Font() {
}
void CFX_Font::DeleteFace() {
FXFT_Done_Face(m_Face);
- m_Face = NULL;
+ m_Face = nullptr;
}
void CFX_Font::LoadSubst(const CFX_ByteString& face_name,
FX_BOOL bTrueType,
@@ -142,7 +142,7 @@ void CFX_Font::LoadSubst(const CFX_ByteString& face_name,
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (m_pSubstFont->m_ExtHandle) {
m_pPlatformFont = m_pSubstFont->m_ExtHandle;
- m_pSubstFont->m_ExtHandle = NULL;
+ m_pSubstFont->m_ExtHandle = nullptr;
}
#endif
if (m_Face) {
@@ -174,7 +174,7 @@ FX_BOOL _LoadFile(FXFT_Library library,
FXFT_Stream* stream,
int32_t faceIndex = 0) {
FXFT_Stream stream1 = (FXFT_Stream)FX_Alloc(uint8_t, sizeof(FXFT_StreamRec));
- stream1->base = NULL;
+ stream1->base = nullptr;
stream1->size = (unsigned long)pFile->GetSize();
stream1->pos = 0;
stream1->descriptor.pointer = pFile;
@@ -239,7 +239,7 @@ FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, uint32_t size) {
m_pFontData = m_pFontDataAllocation;
m_bEmbedded = TRUE;
m_dwSize = size;
- return m_Face != NULL;
+ return !!m_Face;
}
FX_BOOL CFX_Font::IsTTFont() const {
@@ -534,6 +534,6 @@ CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(CFX_Font* pFont,
return pFontEncoding;
}
}
- return NULL;
+ return nullptr;
}
#endif // PDF_ENABLE_XFA
diff --git a/core/fxge/ge/fx_ge_fontmap.cpp b/core/fxge/ge/fx_ge_fontmap.cpp
index 83690c7181..fa53898ecc 100644
--- a/core/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/fxge/ge/fx_ge_fontmap.cpp
@@ -336,7 +336,7 @@ int32_t GetStyleType(const CFX_ByteString& bsStyle, FX_BOOL bRevert) {
return -1;
}
int iSize = sizeof(g_FontStyles) / sizeof(FX_FontStyle);
- const FX_FontStyle* pStyle = NULL;
+ const FX_FontStyle* pStyle = nullptr;
for (int i = iSize - 1; i >= 0; --i) {
pStyle = g_FontStyles + i;
if (!pStyle || pStyle->len > iLen) {
@@ -410,7 +410,7 @@ int32_t GetSimilarValue(int weight,
} // namespace
CFX_SubstFont::CFX_SubstFont() {
- m_ExtHandle = NULL;
+ m_ExtHandle = nullptr;
m_Charset = 0;
m_SubstFlags = 0;
m_Weight = 0;
@@ -517,7 +517,7 @@ FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name,
int face_index) {
CTTFontDesc* pFontDesc = new CTTFontDesc;
pFontDesc->m_Type = 1;
- pFontDesc->m_SingleFace.m_pFace = NULL;
+ pFontDesc->m_SingleFace.m_pFace = nullptr;
pFontDesc->m_SingleFace.m_bBold = weight;
pFontDesc->m_SingleFace.m_bItalic = bItalic;
pFontDesc->m_pFontData = pData;
@@ -529,12 +529,12 @@ FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name,
&pFontDesc->m_SingleFace.m_pFace);
if (ret) {
delete pFontDesc;
- return NULL;
+ return nullptr;
}
ret = FXFT_Set_Pixel_Sizes(pFontDesc->m_SingleFace.m_pFace, 64, 64);
if (ret) {
delete pFontDesc;
- return NULL;
+ return nullptr;
}
m_FaceMap[KeyNameFromFace(face_name, weight, bItalic)] = pFontDesc;
return pFontDesc->m_SingleFace.m_pFace;
@@ -587,7 +587,7 @@ FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size,
pFontDesc->m_Type = 2;
pFontDesc->m_pFontData = pData;
for (int i = 0; i < 16; i++) {
- pFontDesc->m_TTCFace.m_pFaces[i] = NULL;
+ pFontDesc->m_TTCFace.m_pFaces[i] = nullptr;
}
pFontDesc->m_RefCount++;
m_FaceMap[KeyNameFromSize(ttc_size, checksum)] = pFontDesc;
@@ -815,7 +815,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont,
if (m_FoxitFaces[iBaseFont]) {
return m_FoxitFaces[iBaseFont];
}
- const uint8_t* pFontData = NULL;
+ const uint8_t* pFontData = nullptr;
uint32_t size = 0;
if (m_pFontMgr->GetBuiltinFont(iBaseFont, &pFontData, &size)) {
m_FoxitFaces[iBaseFont] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
@@ -833,7 +833,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont,
if (m_MMFaces[1]) {
return m_MMFaces[1];
}
- const uint8_t* pFontData = NULL;
+ const uint8_t* pFontData = nullptr;
uint32_t size = 0;
m_pFontMgr->GetBuiltinFont(14, &pFontData, &size);
m_MMFaces[1] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
@@ -843,7 +843,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont,
if (m_MMFaces[0]) {
return m_MMFaces[0];
}
- const uint8_t* pFontData = NULL;
+ const uint8_t* pFontData = nullptr;
uint32_t size = 0;
m_pFontMgr->GetBuiltinFont(15, &pFontData, &size);
m_MMFaces[0] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
@@ -876,7 +876,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
if (m_FoxitFaces[12]) {
return m_FoxitFaces[12];
}
- const uint8_t* pFontData = NULL;
+ const uint8_t* pFontData = nullptr;
uint32_t size = 0;
m_pFontMgr->GetBuiltinFont(12, &pFontData, &size);
m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
@@ -889,7 +889,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
if (m_FoxitFaces[13]) {
return m_FoxitFaces[13];
}
- const uint8_t* pFontData = NULL;
+ const uint8_t* pFontData = nullptr;
uint32_t size = 0;
m_pFontMgr->GetBuiltinFont(13, &pFontData, &size);
m_FoxitFaces[13] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
@@ -1106,7 +1106,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
if (!hFont) {
#ifdef PDF_ENABLE_XFA
if (flags & FXFONT_EXACTMATCH) {
- return NULL;
+ return nullptr;
}
#endif // PDF_ENABLE_XFA
if (bCJK) {
@@ -1134,7 +1134,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
if (m_FoxitFaces[12]) {
return m_FoxitFaces[12];
}
- const uint8_t* pFontData = NULL;
+ const uint8_t* pFontData = nullptr;
uint32_t size = 0;
m_pFontMgr->GetBuiltinFont(12, &pFontData, &size);
m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
@@ -1207,7 +1207,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
}
if (!face) {
m_pFontInfo->DeleteFont(hFont);
- return NULL;
+ return nullptr;
}
pSubstFont->m_Family = SubstName;
pSubstFont->m_Charset = Charset;
@@ -1263,13 +1263,13 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(uint32_t dwUnicode,
if (!hFont)
return nullptr;
- uint32_t ttc_size = m_pFontInfo->GetFontData(hFont, 0x74746366, NULL, 0);
- uint32_t font_size = m_pFontInfo->GetFontData(hFont, 0, NULL, 0);
+ uint32_t ttc_size = m_pFontInfo->GetFontData(hFont, 0x74746366, nullptr, 0);
+ uint32_t font_size = m_pFontInfo->GetFontData(hFont, 0, nullptr, 0);
if (font_size == 0 && ttc_size == 0) {
m_pFontInfo->DeleteFont(hFont);
- return NULL;
+ return nullptr;
}
- FXFT_Face face = NULL;
+ FXFT_Face face = nullptr;
if (ttc_size) {
uint8_t temp[1024];
m_pFontInfo->GetFontData(hFont, 0x74746366, temp, 1024);
@@ -1322,7 +1322,7 @@ int IFX_SystemFontInfo::GetFaceIndex(void* hFont) {
}
void* IFX_SystemFontInfo::RetainFont(void* hFont) {
- return NULL;
+ return nullptr;
}
int CFX_FontMapper::GetFaceSize() const {
@@ -1566,7 +1566,7 @@ void* CFX_FolderFontInfo::MapFont(int weight,
int pitch_family,
const FX_CHAR* family,
int& iExact) {
- return NULL;
+ return nullptr;
}
#ifdef PDF_ENABLE_XFA
@@ -1574,7 +1574,7 @@ void* CFX_FolderFontInfo::MapFontByUnicode(uint32_t dwUnicode,
int weight,
FX_BOOL bItalic,
int pitch_family) {
- return NULL;
+ return nullptr;
}
#endif // PDF_ENABLE_XFA
diff --git a/core/fxge/ge/fx_ge_linux.cpp b/core/fxge/ge/fx_ge_linux.cpp
index 46d7146026..712d9e07b0 100644
--- a/core/fxge/ge/fx_ge_linux.cpp
+++ b/core/fxge/ge/fx_ge_linux.cpp
@@ -28,11 +28,11 @@ static const struct {
} LinuxGpFontList[] = {
{{"TakaoPGothic", "VL PGothic", "IPAPGothic", "VL Gothic", "Kochi Gothic",
"VL Gothic regular"}},
- {{"TakaoGothic", "VL Gothic", "IPAGothic", "Kochi Gothic", NULL,
+ {{"TakaoGothic", "VL Gothic", "IPAGothic", "Kochi Gothic", nullptr,
"VL Gothic regular"}},
- {{"TakaoPMincho", "IPAPMincho", "VL Gothic", "Kochi Mincho", NULL,
+ {{"TakaoPMincho", "IPAPMincho", "VL Gothic", "Kochi Mincho", nullptr,
"VL Gothic regular"}},
- {{"TakaoMincho", "IPAMincho", "VL Gothic", "Kochi Mincho", NULL,
+ {{"TakaoMincho", "IPAMincho", "VL Gothic", "Kochi Mincho", nullptr,
"VL Gothic regular"}},
};
static const FX_CHAR* const g_LinuxGbFontList[] = {
diff --git a/core/fxge/ge/fx_ge_path.cpp b/core/fxge/ge/fx_ge_path.cpp
index baa391fef2..2abc45f499 100644
--- a/core/fxge/ge/fx_ge_path.cpp
+++ b/core/fxge/ge/fx_ge_path.cpp
@@ -114,7 +114,7 @@ void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) {
}
CFX_PathData::CFX_PathData() {
m_PointCount = m_AllocCount = 0;
- m_pPoints = NULL;
+ m_pPoints = nullptr;
}
CFX_PathData::~CFX_PathData() {
FX_Free(m_pPoints);
@@ -460,7 +460,7 @@ FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath,
m_pPoints[mid - i - 1].m_PointY, FXPT_LINETO);
}
if (!bZeroArea) {
- NewPath.Append(&t_path, NULL);
+ NewPath.Append(&t_path, nullptr);
bThin = TRUE;
return TRUE;
}
@@ -620,21 +620,21 @@ void CFX_PathData::Copy(const CFX_PathData& src) {
CFX_GraphStateData::CFX_GraphStateData() {
m_LineCap = LineCapButt;
m_DashCount = 0;
- m_DashArray = NULL;
+ m_DashArray = nullptr;
m_DashPhase = 0;
m_LineJoin = LineJoinMiter;
m_MiterLimit = 10 * 1.0f;
m_LineWidth = 1.0f;
}
CFX_GraphStateData::CFX_GraphStateData(const CFX_GraphStateData& src) {
- m_DashArray = NULL;
+ m_DashArray = nullptr;
Copy(src);
}
void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) {
m_LineCap = src.m_LineCap;
m_DashCount = src.m_DashCount;
FX_Free(m_DashArray);
- m_DashArray = NULL;
+ m_DashArray = nullptr;
m_DashPhase = src.m_DashPhase;
m_LineJoin = src.m_LineJoin;
m_MiterLimit = src.m_MiterLimit;
@@ -649,7 +649,7 @@ CFX_GraphStateData::~CFX_GraphStateData() {
}
void CFX_GraphStateData::SetDashCount(int count) {
FX_Free(m_DashArray);
- m_DashArray = NULL;
+ m_DashArray = nullptr;
m_DashCount = count;
if (count == 0) {
return;
diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp
index 3243b505b1..c63b292435 100644
--- a/core/fxge/ge/fx_ge_text.cpp
+++ b/core/fxge/ge/fx_ge_text.cpp
@@ -374,7 +374,7 @@ void Color2Argb(FX_ARGB& argb,
}
if (!CFX_GEModule::Get()->GetCodecModule() ||
!CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) {
- pIccTransform = NULL;
+ pIccTransform = nullptr;
}
uint8_t bgra[4];
if (pIccTransform) {
@@ -846,7 +846,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont,
int anti_alias,
int& text_flags) {
if (glyph_index == (uint32_t)-1) {
- return NULL;
+ return nullptr;
}
_CFX_UniqueKeyGen keygen;
#if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
@@ -940,7 +940,7 @@ CFX_SizeGlyphCache::~CFX_SizeGlyphCache() {
}
#define CONTRAST_RAMP_STEP 1
void CFX_Font::AdjustMMParams(int glyph_index, int dest_width, int weight) {
- FXFT_MM_Var pMasters = NULL;
+ FXFT_MM_Var pMasters = nullptr;
FXFT_Get_MM_Var(m_Face, &pMasters);
if (!pMasters) {
return;
@@ -1076,7 +1076,7 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont,
int dest_width,
int anti_alias) {
if (!m_Face) {
- return NULL;
+ return nullptr;
}
FXFT_Matrix ft_matrix;
ft_matrix.xx = (signed long)(pMatrix->GetA() / 64 * 65536);
@@ -1120,14 +1120,14 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont,
if (error) {
// if an error is returned, try to reload glyphs without hinting.
if (load_flags & FT_LOAD_NO_HINTING || load_flags & FT_LOAD_NO_SCALE) {
- return NULL;
+ return nullptr;
}
load_flags |= FT_LOAD_NO_HINTING;
error = FXFT_Load_Glyph(m_Face, glyph_index, load_flags);
if (error) {
- return NULL;
+ return nullptr;
}
}
int weight = 0;
@@ -1140,7 +1140,7 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont,
weight > 400) {
uint32_t index = (weight - 400) / 10;
if (index >= WEIGHTPOW_ARRAY_SIZE)
- return NULL;
+ return nullptr;
int level = 0;
if (pSubstFont->m_Charset == FXFONT_SHIFTJIS_CHARSET) {
level =
@@ -1158,12 +1158,12 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont,
FT_LCD_FILTER_DEFAULT);
error = FXFT_Render_Glyph(m_Face, anti_alias);
if (error) {
- return NULL;
+ return nullptr;
}
int bmwidth = FXFT_Get_Bitmap_Width(FXFT_Get_Glyph_Bitmap(m_Face));
int bmheight = FXFT_Get_Bitmap_Rows(FXFT_Get_Glyph_Bitmap(m_Face));
if (bmwidth > 2048 || bmheight > 2048) {
- return NULL;
+ return nullptr;
}
int dib_width = bmwidth;
CFX_GlyphBitmap* pGlyphBitmap = new CFX_GlyphBitmap;
@@ -1357,7 +1357,7 @@ static int _Outline_CubicTo(const FXFT_Vector* control1,
};
CFX_PathData* CFX_Font::LoadGlyphPath(uint32_t glyph_index, int dest_width) {
if (!m_Face) {
- return NULL;
+ return nullptr;
}
FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
FXFT_Matrix ft_matrix = {65536, 0, 0, 65536};
@@ -1387,7 +1387,7 @@ CFX_PathData* CFX_Font::LoadGlyphPath(uint32_t glyph_index, int dest_width) {
load_flags |= FT_LOAD_NO_HINTING;
}
if (FXFT_Load_Glyph(m_Face, glyph_index, load_flags))
- return NULL;
+ return nullptr;
if (m_pSubstFont && !(m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) &&
m_pSubstFont->m_Weight > 400) {
uint32_t index = (m_pSubstFont->m_Weight - 400) / 10;
@@ -1412,7 +1412,7 @@ CFX_PathData* CFX_Font::LoadGlyphPath(uint32_t glyph_index, int dest_width) {
params.m_PointCount = 0;
FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face), &funcs, &params);
if (params.m_PointCount == 0) {
- return NULL;
+ return nullptr;
}
CFX_PathData* pPath = new CFX_PathData;
pPath->SetPointCount(params.m_PointCount);
diff --git a/core/fxge/ge/fx_text_int.h b/core/fxge/ge/fx_text_int.h
index c3e9cd7679..2ca23217c7 100644
--- a/core/fxge/ge/fx_text_int.h
+++ b/core/fxge/ge/fx_text_int.h
@@ -27,7 +27,7 @@ class CTTFontDesc {
public:
CTTFontDesc() {
m_Type = 0;
- m_pFontData = NULL;
+ m_pFontData = nullptr;
m_RefCount = 0;
}
~CTTFontDesc();
diff --git a/core/fxge/include/fx_dib.h b/core/fxge/include/fx_dib.h
index 12ed03c1d3..4919ba70fe 100644
--- a/core/fxge/include/fx_dib.h
+++ b/core/fxge/include/fx_dib.h
@@ -204,28 +204,28 @@ class CFX_DIBSource {
void CopyPalette(const uint32_t* pSrcPal, uint32_t size = 256);
- CFX_DIBitmap* Clone(const FX_RECT* pClip = NULL) const;
+ CFX_DIBitmap* Clone(const FX_RECT* pClip = nullptr) const;
CFX_DIBitmap* CloneConvert(FXDIB_Format format,
- const FX_RECT* pClip = NULL,
- void* pIccTransform = NULL) const;
+ const FX_RECT* pClip = nullptr,
+ void* pIccTransform = nullptr) const;
CFX_DIBitmap* StretchTo(int dest_width,
int dest_height,
uint32_t flags = 0,
- const FX_RECT* pClip = NULL) const;
+ const FX_RECT* pClip = nullptr) const;
CFX_DIBitmap* TransformTo(const CFX_Matrix* pMatrix,
int& left,
int& top,
uint32_t flags = 0,
- const FX_RECT* pClip = NULL) const;
+ const FX_RECT* pClip = nullptr) const;
- CFX_DIBitmap* GetAlphaMask(const FX_RECT* pClip = NULL) const;
+ CFX_DIBitmap* GetAlphaMask(const FX_RECT* pClip = nullptr) const;
FX_BOOL CopyAlphaMask(const CFX_DIBSource* pAlphaMask,
- const FX_RECT* pClip = NULL);
+ const FX_RECT* pClip = nullptr);
CFX_DIBitmap* SwapXY(FX_BOOL bXFlip,
FX_BOOL bYFlip,
- const FX_RECT* pClip = NULL) const;
+ const FX_RECT* pClip = nullptr) const;
CFX_DIBitmap* FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const;
@@ -266,7 +266,7 @@ class CFX_DIBitmap : public CFX_DIBSource {
FX_BOOL Create(int width,
int height,
FXDIB_Format format,
- uint8_t* pBuffer = NULL,
+ uint8_t* pBuffer = nullptr,
int pitch = 0);
FX_BOOL Copy(const CFX_DIBSource* pSrc);
@@ -284,7 +284,7 @@ class CFX_DIBitmap : public CFX_DIBSource {
void TakeOver(CFX_DIBitmap* pSrcBitmap);
- FX_BOOL ConvertFormat(FXDIB_Format format, void* pIccTransform = NULL);
+ FX_BOOL ConvertFormat(FXDIB_Format format, void* pIccTransform = nullptr);
void Clear(uint32_t color);
@@ -309,7 +309,7 @@ class CFX_DIBitmap : public CFX_DIBSource {
const CFX_DIBSource* pSrcBitmap,
int src_left,
int src_top,
- void* pIccTransform = NULL);
+ void* pIccTransform = nullptr);
FX_BOOL CompositeBitmap(int dest_left,
int dest_top,
@@ -319,9 +319,9 @@ class CFX_DIBitmap : public CFX_DIBSource {
int src_left,
int src_top,
int blend_type = FXDIB_BLEND_NORMAL,
- const CFX_ClipRgn* pClipRgn = NULL,
+ const CFX_ClipRgn* pClipRgn = nullptr,
FX_BOOL bRgbByteOrder = FALSE,
- void* pIccTransform = NULL);
+ void* pIccTransform = nullptr);
FX_BOOL TransferMask(int dest_left,
int dest_top,
@@ -332,7 +332,7 @@ class CFX_DIBitmap : public CFX_DIBSource {
int src_left,
int src_top,
int alpha_flag = 0,
- void* pIccTransform = NULL);
+ void* pIccTransform = nullptr);
FX_BOOL CompositeMask(int dest_left,
int dest_top,
@@ -343,10 +343,10 @@ class CFX_DIBitmap : public CFX_DIBSource {
int src_left,
int src_top,
int blend_type = FXDIB_BLEND_NORMAL,
- const CFX_ClipRgn* pClipRgn = NULL,
+ const CFX_ClipRgn* pClipRgn = nullptr,
FX_BOOL bRgbByteOrder = FALSE,
int alpha_flag = 0,
- void* pIccTransform = NULL);
+ void* pIccTransform = nullptr);
FX_BOOL CompositeRect(int dest_left,
int dest_top,
@@ -354,12 +354,12 @@ class CFX_DIBitmap : public CFX_DIBSource {
int height,
uint32_t color,
int alpha_flag = 0,
- void* pIccTransform = NULL);
+ void* pIccTransform = nullptr);
FX_BOOL ConvertColorScale(uint32_t forecolor, uint32_t backcolor);
protected:
- FX_BOOL GetGrayData(void* pIccTransform = NULL);
+ FX_BOOL GetGrayData(void* pIccTransform = nullptr);
uint8_t* m_pBuffer;
FX_BOOL m_bExtBuf;
@@ -421,7 +421,7 @@ class IFX_ScanlineComposer {
virtual void ComposeScanline(int line,
const uint8_t* scanline,
- const uint8_t* scan_extra_alpha = NULL) = 0;
+ const uint8_t* scan_extra_alpha = nullptr) = 0;
virtual FX_BOOL SetInfo(int width,
int height,
@@ -443,35 +443,35 @@ class CFX_ScanlineCompositor {
FX_BOOL bClip,
FX_BOOL bRgbByteOrder = FALSE,
int alpha_flag = 0,
- void* pIccTransform = NULL);
+ void* pIccTransform = nullptr);
void CompositeRgbBitmapLine(uint8_t* dest_scan,
const uint8_t* src_scan,
int width,
const uint8_t* clip_scan,
- const uint8_t* src_extra_alpha = NULL,
- uint8_t* dst_extra_alpha = NULL);
+ const uint8_t* src_extra_alpha = nullptr,
+ uint8_t* dst_extra_alpha = nullptr);
void CompositePalBitmapLine(uint8_t* dest_scan,
const uint8_t* src_scan,
int src_left,
int width,
const uint8_t* clip_scan,
- const uint8_t* src_extra_alpha = NULL,
- uint8_t* dst_extra_alpha = NULL);
+ const uint8_t* src_extra_alpha = nullptr,
+ uint8_t* dst_extra_alpha = nullptr);
void CompositeByteMaskLine(uint8_t* dest_scan,
const uint8_t* src_scan,
int width,
const uint8_t* clip_scan,
- uint8_t* dst_extra_alpha = NULL);
+ uint8_t* dst_extra_alpha = nullptr);
void CompositeBitMaskLine(uint8_t* dest_scan,
const uint8_t* src_scan,
int src_left,
int width,
const uint8_t* clip_scan,
- uint8_t* dst_extra_alpha = NULL);
+ uint8_t* dst_extra_alpha = nullptr);
protected:
int m_Transparency;
@@ -501,7 +501,7 @@ class CFX_BitmapComposer : public IFX_ScanlineComposer {
FX_BOOL bFlipY,
FX_BOOL bRgbByteOrder = FALSE,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL);
// IFX_ScanlineComposer
@@ -519,8 +519,8 @@ class CFX_BitmapComposer : public IFX_ScanlineComposer {
const uint8_t* src_scan,
int dest_width,
const uint8_t* clip_scan,
- const uint8_t* src_extra_alpha = NULL,
- uint8_t* dst_extra_alpha = NULL);
+ const uint8_t* src_extra_alpha = nullptr,
+ uint8_t* dst_extra_alpha = nullptr);
CFX_DIBitmap* m_pBitmap;
const CFX_ClipRgn* m_pClipRgn;
FXDIB_Format m_SrcFormat;
@@ -535,7 +535,7 @@ class CFX_BitmapComposer : public IFX_ScanlineComposer {
int m_BlendType;
void ComposeScanlineV(int line,
const uint8_t* scanline,
- const uint8_t* scan_extra_alpha = NULL);
+ const uint8_t* scan_extra_alpha = nullptr);
uint8_t* m_pScanlineV;
uint8_t* m_pClipScanV;
uint8_t* m_pAddClipScan;
@@ -642,7 +642,7 @@ class CFX_ImageRenderer {
uint32_t dib_flags,
FX_BOOL bRgbByteOrder = FALSE,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL);
FX_BOOL Continue(IFX_Pause* pPause);
diff --git a/core/fxge/include/fx_font.h b/core/fxge/include/fx_font.h
index 023a6a0928..13143d518b 100644
--- a/core/fxge/include/fx_font.h
+++ b/core/fxge/include/fx_font.h
@@ -83,7 +83,7 @@ class CFX_Font {
#ifdef PDF_ENABLE_XFA
FX_BOOL LoadFile(IFX_FileRead* pFile,
int nFaceIndex = 0,
- int* pFaceCount = NULL);
+ int* pFaceCount = nullptr);
FX_BOOL LoadClone(const CFX_Font* pFont);
CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; }
diff --git a/core/fxge/include/fx_ge.h b/core/fxge/include/fx_ge.h
index 1cbbc2cc97..040c16afa2 100644
--- a/core/fxge/include/fx_ge.h
+++ b/core/fxge/include/fx_ge.h
@@ -424,7 +424,7 @@ class IFX_RenderDeviceDriver {
static IFX_RenderDeviceDriver* CreateFxgeDriver(
CFX_DIBitmap* pBitmap,
FX_BOOL bRgbByteOrder = FALSE,
- CFX_DIBitmap* pOriDevice = NULL,
+ CFX_DIBitmap* pOriDevice = nullptr,
FX_BOOL bGroupKnockout = FALSE);
virtual ~IFX_RenderDeviceDriver() {}
@@ -458,21 +458,21 @@ class IFX_RenderDeviceDriver {
uint32_t stroke_color,
int fill_mode,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) = 0;
virtual FX_BOOL SetPixel(int x,
int y,
uint32_t color,
int alpha_flag = 0,
- void* pIccTransform = NULL) {
+ void* pIccTransform = nullptr) {
return FALSE;
}
virtual FX_BOOL FillRect(const FX_RECT* pRect,
uint32_t fill_color,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) {
return FALSE;
}
@@ -483,7 +483,7 @@ class IFX_RenderDeviceDriver {
FX_FLOAT y2,
uint32_t color,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) {
return FALSE;
}
@@ -493,11 +493,11 @@ class IFX_RenderDeviceDriver {
virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
int left,
int top,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
FX_BOOL bDEdge = FALSE) {
return FALSE;
}
- virtual CFX_DIBitmap* GetBackDrop() { return NULL; }
+ virtual CFX_DIBitmap* GetBackDrop() { return nullptr; }
virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
@@ -506,7 +506,7 @@ class IFX_RenderDeviceDriver {
int dest_top,
int blend_type,
int alpha_flag = 0,
- void* pIccTransform = NULL) = 0;
+ void* pIccTransform = nullptr) = 0;
virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
@@ -517,7 +517,7 @@ class IFX_RenderDeviceDriver {
const FX_RECT* pClipRect,
uint32_t flags,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) = 0;
virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
@@ -527,7 +527,7 @@ class IFX_RenderDeviceDriver {
uint32_t flags,
void*& handle,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) = 0;
virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) {
@@ -544,11 +544,11 @@ class IFX_RenderDeviceDriver {
FX_FLOAT font_size,
uint32_t color,
int alpha_flag = 0,
- void* pIccTransform = NULL) {
+ void* pIccTransform = nullptr) {
return FALSE;
}
- virtual void* GetPlatformSurface() const { return NULL; }
+ virtual void* GetPlatformSurface() const { return nullptr; }
virtual int GetDriverType() const { return 0; }
virtual void ClearDriver() {}
diff --git a/core/fxge/include/fx_ge_win32.h b/core/fxge/include/fx_ge_win32.h
index a6d8fbb378..e7207a5f70 100644
--- a/core/fxge/include/fx_ge_win32.h
+++ b/core/fxge/include/fx_ge_win32.h
@@ -33,7 +33,7 @@ class CFX_WindowsDIB : public CFX_DIBitmap {
static CFX_DIBitmap* LoadFromDDB(HDC hDC,
HBITMAP hBitmap,
- uint32_t* pPalette = NULL,
+ uint32_t* pPalette = nullptr,
uint32_t size = 256);
static CFX_DIBitmap* LoadFromFile(const FX_WCHAR* filename);
diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h
index 085977b66e..c9ff9f1632 100644
--- a/core/fxge/skia/fx_skia_device.h
+++ b/core/fxge/skia/fx_skia_device.h
@@ -53,13 +53,13 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
uint32_t stroke_color,
int fill_mode,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) override;
FX_BOOL FillRect(const FX_RECT* pRect,
uint32_t fill_color,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) override;
/** Draw a single pixel (device dependant) line */
@@ -69,7 +69,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
FX_FLOAT y2,
uint32_t color,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) override {
return FALSE;
}
@@ -80,7 +80,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
int left,
int top,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
FX_BOOL bDEdge = FALSE) override;
CFX_DIBitmap* GetBackDrop() override { return m_pOriDevice; }
@@ -92,7 +92,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
int dest_top,
int blend_type,
int alpha_flag = 0,
- void* pIccTransform = NULL) override;
+ void* pIccTransform = nullptr) override;
FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
int dest_left,
@@ -102,7 +102,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
const FX_RECT* pClipRect,
uint32_t flags,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) override;
FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
@@ -112,7 +112,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
uint32_t flags,
void*& handle,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL) override;
FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override {
@@ -129,7 +129,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
FX_FLOAT font_size,
uint32_t color,
int alpha_flag = 0,
- void* pIccTransform = NULL) override;
+ void* pIccTransform = nullptr) override;
FX_BOOL DrawShading(const CPDF_ShadingPattern* pPattern,
const CFX_Matrix* pMatrix,
diff --git a/core/fxge/win32/dwrite_int.h b/core/fxge/win32/dwrite_int.h
index 60cc981a48..f49fda44dd 100644
--- a/core/fxge/win32/dwrite_int.h
+++ b/core/fxge/win32/dwrite_int.h
@@ -34,7 +34,7 @@ class CDWriteExt {
void Load();
void Unload();
- FX_BOOL IsAvailable() { return m_pDWriteFactory != NULL; }
+ FX_BOOL IsAvailable() { return !!m_pDWriteFactory; }
void* DwCreateFontFaceFromStream(uint8_t* pData,
uint32_t size,
diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp
index eefa991eeb..7221d10536 100644
--- a/core/fxge/win32/fx_win32_dib.cpp
+++ b/core/fxge/win32/fx_win32_dib.cpp
@@ -69,7 +69,7 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
FX_BOOL ret = pBitmap->Create(width, height, format);
if (!ret) {
delete pBitmap;
- return NULL;
+ return nullptr;
}
FXSYS_memcpy(pBitmap->GetBuffer(), pData, pitch * height);
if (bBottomUp) {
@@ -84,7 +84,7 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
bottom--;
}
FX_Free(temp_buf);
- temp_buf = NULL;
+ temp_buf = nullptr;
}
if (pbmi->bmiHeader.biBitCount == 1) {
for (int i = 0; i < 2; i++) {
@@ -102,11 +102,9 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData) {
}
HBITMAP CFX_WindowsDIB::GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC) {
CFX_ByteString info = GetBitmapInfo(pBitmap);
- HBITMAP hBitmap = NULL;
- hBitmap = CreateDIBitmap(hDC, (BITMAPINFOHEADER*)info.c_str(), CBM_INIT,
- pBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(),
- DIB_RGB_COLORS);
- return hBitmap;
+ return CreateDIBitmap(hDC, (BITMAPINFOHEADER*)info.c_str(), CBM_INIT,
+ pBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(),
+ DIB_RGB_COLORS);
}
void GetBitmapSize(HBITMAP hBitmap, int& w, int& h) {
BITMAP bmp;
@@ -123,26 +121,26 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_WCHAR* filename) {
args.path_name = filename;
return pPlatform->m_GdiplusExt.LoadDIBitmap(args);
}
- HBITMAP hBitmap = (HBITMAP)LoadImageW(NULL, (wchar_t*)filename, IMAGE_BITMAP,
- 0, 0, LR_LOADFROMFILE);
+ HBITMAP hBitmap = (HBITMAP)LoadImageW(nullptr, (wchar_t*)filename,
+ IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if (!hBitmap) {
- return NULL;
+ return nullptr;
}
- HDC hDC = CreateCompatibleDC(NULL);
+ HDC hDC = CreateCompatibleDC(nullptr);
int width, height;
GetBitmapSize(hBitmap, width, height);
CFX_DIBitmap* pDIBitmap = new CFX_DIBitmap;
if (!pDIBitmap->Create(width, height, FXDIB_Rgb)) {
delete pDIBitmap;
DeleteDC(hDC);
- return NULL;
+ return nullptr;
}
CFX_ByteString info = GetBitmapInfo(pDIBitmap);
int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(),
(BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
if (!ret) {
delete pDIBitmap;
- pDIBitmap = NULL;
+ pDIBitmap = nullptr;
}
DeleteDC(hDC);
return pDIBitmap;
@@ -154,28 +152,28 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) {
return pPlatform->m_GdiplusExt.LoadDIBitmap(args);
}
if (args.flags == WINDIB_OPEN_MEMORY) {
- return NULL;
+ return nullptr;
}
- HBITMAP hBitmap = (HBITMAP)LoadImageW(NULL, (wchar_t*)args.path_name,
+ HBITMAP hBitmap = (HBITMAP)LoadImageW(nullptr, (wchar_t*)args.path_name,
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if (!hBitmap) {
- return NULL;
+ return nullptr;
}
- HDC hDC = CreateCompatibleDC(NULL);
+ HDC hDC = CreateCompatibleDC(nullptr);
int width, height;
GetBitmapSize(hBitmap, width, height);
CFX_DIBitmap* pDIBitmap = new CFX_DIBitmap;
if (!pDIBitmap->Create(width, height, FXDIB_Rgb)) {
delete pDIBitmap;
DeleteDC(hDC);
- return NULL;
+ return nullptr;
}
CFX_ByteString info = GetBitmapInfo(pDIBitmap);
int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(),
(BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
if (!ret) {
delete pDIBitmap;
- pDIBitmap = NULL;
+ pDIBitmap = nullptr;
}
DeleteDC(hDC);
return pDIBitmap;
@@ -186,12 +184,12 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC,
uint32_t palsize) {
FX_BOOL bCreatedDC = !hDC;
if (bCreatedDC) {
- hDC = CreateCompatibleDC(NULL);
+ hDC = CreateCompatibleDC(nullptr);
}
BITMAPINFOHEADER bmih;
FXSYS_memset(&bmih, 0, sizeof bmih);
bmih.biSize = sizeof bmih;
- GetDIBits(hDC, hBitmap, 0, 0, NULL, (BITMAPINFO*)&bmih, DIB_RGB_COLORS);
+ GetDIBits(hDC, hBitmap, 0, 0, nullptr, (BITMAPINFO*)&bmih, DIB_RGB_COLORS);
int width = bmih.biWidth;
int height = abs(bmih.biHeight);
bmih.biHeight = -height;
@@ -218,12 +216,12 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC,
if (bCreatedDC) {
DeleteDC(hDC);
}
- return NULL;
+ return nullptr;
}
ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(),
(BITMAPINFO*)pbmih, DIB_RGB_COLORS);
FX_Free(pbmih);
- pbmih = NULL;
+ pbmih = nullptr;
pDIBitmap->CopyPalette(pPalette, palsize);
} else {
if (bmih.biBitCount <= 24) {
@@ -237,7 +235,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC,
if (bCreatedDC) {
DeleteDC(hDC);
}
- return NULL;
+ return nullptr;
}
ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(),
(BITMAPINFO*)&bmih, DIB_RGB_COLORS);
@@ -254,7 +252,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC,
}
if (ret == 0) {
delete pDIBitmap;
- pDIBitmap = NULL;
+ pDIBitmap = nullptr;
}
if (bCreatedDC) {
DeleteDC(hDC);
@@ -271,7 +269,7 @@ CFX_WindowsDIB::CFX_WindowsDIB(HDC hDC, int width, int height) {
bmih.biPlanes = 1;
bmih.biWidth = width;
m_hBitmap = CreateDIBSection(hDC, (BITMAPINFO*)&bmih, DIB_RGB_COLORS,
- (LPVOID*)&m_pBuffer, NULL, 0);
+ (LPVOID*)&m_pBuffer, nullptr, 0);
m_hMemDC = CreateCompatibleDC(hDC);
m_hOldBitmap = (HBITMAP)SelectObject(m_hMemDC, m_hBitmap);
}
diff --git a/core/fxge/win32/fx_win32_dwrite.cpp b/core/fxge/win32/fx_win32_dwrite.cpp
index aa6ba9c8b9..5f620cba4c 100644
--- a/core/fxge/win32/fx_win32_dwrite.cpp
+++ b/core/fxge/win32/fx_win32_dwrite.cpp
@@ -20,7 +20,7 @@ template <typename InterfaceType>
inline void SafeRelease(InterfaceType** currentObject) {
if (*currentObject) {
(*currentObject)->Release();
- *currentObject = NULL;
+ *currentObject = nullptr;
}
}
template <typename InterfaceType>
@@ -46,7 +46,7 @@ class CDwFontFileStream final : public IDWriteFontFileStream {
virtual void STDMETHODCALLTYPE ReleaseFileFragment(void* fragmentContext);
virtual HRESULT STDMETHODCALLTYPE GetFileSize(OUT UINT64* fileSize);
virtual HRESULT STDMETHODCALLTYPE GetLastWriteTime(OUT UINT64* lastWriteTime);
- bool IsInitialized() { return resourcePtr_ != NULL; }
+ bool IsInitialized() { return !!resourcePtr_; }
private:
ULONG refCount_;
@@ -70,7 +70,7 @@ class CDwFontFileLoader final : public IDWriteFontFileLoader {
}
return instance_;
}
- static bool IsLoaderInitialized() { return instance_ != NULL; }
+ static bool IsLoaderInitialized() { return !!instance_; }
private:
CDwFontFileLoader();
@@ -110,16 +110,16 @@ class CDwGdiTextRenderer {
IDWriteRenderingParams* pRenderingParams_;
};
CDWriteExt::CDWriteExt() {
- m_hModule = NULL;
- m_pDWriteFactory = NULL;
- m_pDwFontContext = NULL;
- m_pDwTextRenderer = NULL;
+ m_hModule = nullptr;
+ m_pDWriteFactory = nullptr;
+ m_pDwFontContext = nullptr;
+ m_pDwTextRenderer = nullptr;
}
void CDWriteExt::Load() {}
void CDWriteExt::Unload() {
if (m_pDwFontContext) {
delete (CDwFontContext*)m_pDwFontContext;
- m_pDwFontContext = NULL;
+ m_pDwFontContext = nullptr;
}
SafeRelease((IDWriteFactory**)&m_pDWriteFactory);
}
@@ -130,8 +130,8 @@ LPVOID CDWriteExt::DwCreateFontFaceFromStream(uint8_t* pData,
uint32_t size,
int simulation_style) {
IDWriteFactory* pDwFactory = (IDWriteFactory*)m_pDWriteFactory;
- IDWriteFontFile* pDwFontFile = NULL;
- IDWriteFontFace* pDwFontFace = NULL;
+ IDWriteFontFile* pDwFontFile = nullptr;
+ IDWriteFontFace* pDwFontFace = nullptr;
BOOL isSupportedFontType = FALSE;
DWRITE_FONT_FILE_TYPE fontFileType;
DWRITE_FONT_FACE_TYPE fontFaceType;
@@ -160,7 +160,7 @@ LPVOID CDWriteExt::DwCreateFontFaceFromStream(uint8_t* pData,
return pDwFontFace;
failed:
SafeRelease(&pDwFontFile);
- return NULL;
+ return nullptr;
}
FX_BOOL CDWriteExt::DwCreateRenderingTarget(CFX_DIBitmap* pBitmap,
void** renderTarget) {
@@ -168,16 +168,16 @@ FX_BOOL CDWriteExt::DwCreateRenderingTarget(CFX_DIBitmap* pBitmap,
return FALSE;
}
IDWriteFactory* pDwFactory = (IDWriteFactory*)m_pDWriteFactory;
- IDWriteGdiInterop* pGdiInterop = NULL;
- IDWriteBitmapRenderTarget* pBitmapRenderTarget = NULL;
- IDWriteRenderingParams* pRenderingParams = NULL;
+ IDWriteGdiInterop* pGdiInterop = nullptr;
+ IDWriteBitmapRenderTarget* pBitmapRenderTarget = nullptr;
+ IDWriteRenderingParams* pRenderingParams = nullptr;
HRESULT hr = S_OK;
hr = pDwFactory->GetGdiInterop(&pGdiInterop);
if (FAILED(hr)) {
goto failed;
}
hr = pGdiInterop->CreateBitmapRenderTarget(
- NULL, pBitmap->GetWidth(), pBitmap->GetHeight(), &pBitmapRenderTarget);
+ nullptr, pBitmap->GetWidth(), pBitmap->GetHeight(), &pBitmapRenderTarget);
if (FAILED(hr)) {
goto failed;
}
@@ -240,7 +240,7 @@ FX_BOOL CDWriteExt::DwRendingString(void* renderTarget,
glyphRun.isSideways = FALSE;
glyphRun.bidiLevel = 0;
hr = pTextRenderer->DrawGlyphRun(
- stringRect, pClipRgn, pMatrix ? &transform : NULL, baselineOriginX,
+ stringRect, pClipRgn, pMatrix ? &transform : nullptr, baselineOriginX,
baselineOriginY, DWRITE_MEASURING_MODE_NATURAL, &glyphRun,
RGB(FXARGB_R(text_color), FXARGB_G(text_color), FXARGB_B(text_color)));
return SUCCEEDED(hr);
@@ -266,7 +266,7 @@ HRESULT STDMETHODCALLTYPE CDwFontFileStream::QueryInterface(REFIID iid,
AddRef();
return S_OK;
}
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG STDMETHODCALLTYPE CDwFontFileStream::AddRef() {
@@ -288,11 +288,11 @@ CDwFontFileStream::ReadFileFragment(void const** fragmentStart,
fragmentSize <= resourceSize_ - fileOffset) {
*fragmentStart = static_cast<uint8_t const*>(resourcePtr_) +
static_cast<size_t>(fileOffset);
- *fragmentContext = NULL;
+ *fragmentContext = nullptr;
return S_OK;
}
- *fragmentStart = NULL;
- *fragmentContext = NULL;
+ *fragmentStart = nullptr;
+ *fragmentContext = nullptr;
return E_FAIL;
}
void STDMETHODCALLTYPE
@@ -306,7 +306,7 @@ CDwFontFileStream::GetLastWriteTime(OUT UINT64* lastWriteTime) {
*lastWriteTime = 0;
return E_NOTIMPL;
}
-IDWriteFontFileLoader* CDwFontFileLoader::instance_ = NULL;
+IDWriteFontFileLoader* CDwFontFileLoader::instance_ = nullptr;
CDwFontFileLoader::CDwFontFileLoader() : refCount_(0) {}
HRESULT STDMETHODCALLTYPE CDwFontFileLoader::QueryInterface(REFIID iid,
void** ppvObject) {
@@ -315,7 +315,7 @@ HRESULT STDMETHODCALLTYPE CDwFontFileLoader::QueryInterface(REFIID iid,
AddRef();
return S_OK;
}
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
ULONG STDMETHODCALLTYPE CDwFontFileLoader::AddRef() {
@@ -324,7 +324,7 @@ ULONG STDMETHODCALLTYPE CDwFontFileLoader::AddRef() {
ULONG STDMETHODCALLTYPE CDwFontFileLoader::Release() {
ULONG newCount = InterlockedDecrement((long*)(&refCount_));
if (newCount == 0) {
- instance_ = NULL;
+ instance_ = nullptr;
delete this;
}
return newCount;
@@ -333,7 +333,7 @@ HRESULT STDMETHODCALLTYPE CDwFontFileLoader::CreateStreamFromKey(
void const* fontFileReferenceKey,
UINT32 fontFileReferenceKeySize,
OUT IDWriteFontFileStream** fontFileStream) {
- *fontFileStream = NULL;
+ *fontFileStream = nullptr;
CDwFontFileStream* stream =
new CDwFontFileStream(fontFileReferenceKey, fontFileReferenceKeySize);
if (!stream->IsInitialized()) {
@@ -395,7 +395,7 @@ STDMETHODIMP CDwGdiTextRenderer::DrawGlyphRun(
(uint8_t*)bitmap.bmBits);
dib.CompositeBitmap(text_bbox.left, text_bbox.top, text_bbox.Width(),
text_bbox.Height(), pBitmap_, text_bbox.left,
- text_bbox.top, FXDIB_BLEND_NORMAL, NULL);
+ text_bbox.top, FXDIB_BLEND_NORMAL, nullptr);
hr = pRenderTarget_->DrawGlyphRun(baselineOriginX, baselineOriginY,
measuringMode, glyphRun, pRenderingParams_,
textColor);
diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp
index eb24410900..68b9aaa80e 100644
--- a/core/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/fxge/win32/fx_win32_gdipext.cpp
@@ -444,7 +444,7 @@ void* CGdiplusExt::GdiAddFontMemResourceEx(void* pFontdata,
return ((FuncType_GdiAddFontMemResourceEx)m_pGdiAddFontMemResourceEx)(
(PVOID)pFontdata, (DWORD)size, (PVOID)pdv, (DWORD*)num_face);
}
- return NULL;
+ return nullptr;
}
FX_BOOL CGdiplusExt::GdiRemoveFontMemResourceEx(void* handle) {
if (m_pGdiRemoveFontMemResourseEx) {
@@ -456,7 +456,7 @@ FX_BOOL CGdiplusExt::GdiRemoveFontMemResourceEx(void* handle) {
static GpBrush* _GdipCreateBrush(DWORD argb) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
- GpSolidFill* solidBrush = NULL;
+ GpSolidFill* solidBrush = nullptr;
CallFunc(GdipCreateSolidFill)((ARGB)argb, &solidBrush);
return solidBrush;
}
@@ -478,7 +478,7 @@ static CFX_DIBitmap* _StretchMonoToGray(int dest_width,
CFX_DIBitmap* pStretched = new CFX_DIBitmap;
if (!pStretched->Create(result_width, result_height, FXDIB_8bppRgb)) {
delete pStretched;
- return NULL;
+ return nullptr;
}
LPBYTE dest_buf = pStretched->GetBuffer();
int src_width = pSource->GetWidth();
@@ -560,7 +560,7 @@ static void OutputImageMask(GpGraphics* pGraphics,
return;
}
image_clip.Offset(-image_rect.left, -image_rect.top);
- CFX_DIBitmap* pStretched = NULL;
+ CFX_DIBitmap* pStretched = nullptr;
if (src_width * src_height > 10000) {
pStretched =
_StretchMonoToGray(dest_width, dest_height, pBitmap, &image_clip);
@@ -624,7 +624,7 @@ static void OutputImage(GpGraphics* pGraphics,
int src_pitch = pBitmap->GetPitch();
uint8_t* scan0 = pBitmap->GetBuffer() + pSrcRect->top * src_pitch +
pBitmap->GetBPP() * pSrcRect->left / 8;
- GpBitmap* bitmap = NULL;
+ GpBitmap* bitmap = nullptr;
switch (pBitmap->GetFormat()) {
case FXDIB_Argb:
CallFunc(GdipCreateBitmapFromScan0)(src_width, src_height, src_pitch,
@@ -671,13 +671,13 @@ static void OutputImage(GpGraphics* pGraphics,
CallFunc(GdipDisposeImage)(bitmap);
}
CGdiplusExt::CGdiplusExt() {
- m_hModule = NULL;
- m_GdiModule = NULL;
+ m_hModule = nullptr;
+ m_GdiModule = nullptr;
for (size_t i = 0; i < sizeof g_GdipFuncNames / sizeof(LPCSTR); i++) {
- m_Functions[i] = NULL;
+ m_Functions[i] = nullptr;
}
- m_pGdiAddFontMemResourceEx = NULL;
- m_pGdiRemoveFontMemResourseEx = NULL;
+ m_pGdiAddFontMemResourceEx = nullptr;
+ m_pGdiRemoveFontMemResourseEx = nullptr;
}
void CGdiplusExt::Load() {
CFX_ByteString strPlusPath = "";
@@ -693,14 +693,14 @@ void CGdiplusExt::Load() {
for (size_t i = 0; i < sizeof g_GdipFuncNames / sizeof(LPCSTR); i++) {
m_Functions[i] = GetProcAddress(m_hModule, g_GdipFuncNames[i]);
if (!m_Functions[i]) {
- m_hModule = NULL;
+ m_hModule = nullptr;
return;
}
}
uintptr_t gdiplusToken;
GdiplusStartupInput gdiplusStartupInput;
((FuncType_GdiplusStartup)m_Functions[FuncId_GdiplusStartup])(
- &gdiplusToken, &gdiplusStartupInput, NULL);
+ &gdiplusToken, &gdiplusStartupInput, nullptr);
m_GdiModule = LoadLibraryA("GDI32.DLL");
if (!m_GdiModule) {
return;
@@ -712,7 +712,7 @@ void CGdiplusExt::Load() {
}
CGdiplusExt::~CGdiplusExt() {}
LPVOID CGdiplusExt::LoadMemFont(LPBYTE pData, uint32_t size) {
- GpFontCollection* pCollection = NULL;
+ GpFontCollection* pCollection = nullptr;
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
CallFunc(GdipNewPrivateFontCollection)(&pCollection);
@@ -722,7 +722,7 @@ LPVOID CGdiplusExt::LoadMemFont(LPBYTE pData, uint32_t size) {
return pCollection;
}
CallFunc(GdipDeletePrivateFontCollection)(&pCollection);
- return NULL;
+ return nullptr;
}
void CGdiplusExt::DeleteMemFont(LPVOID pCollection) {
CGdiplusExt& GdiplusExt =
@@ -852,19 +852,19 @@ void* CGdiplusExt::GdipCreateFontFromCollection(void* pFontCollection,
GpStatus status = CallFunc(GdipGetFontCollectionFamilyCount)(
(GpFontCollection*)pFontCollection, &numFamilies);
if (status != Ok) {
- return NULL;
+ return nullptr;
}
GpFontFamily* family_list[1];
status = CallFunc(GdipGetFontCollectionFamilyList)(
(GpFontCollection*)pFontCollection, 1, family_list, &numFamilies);
if (status != Ok) {
- return NULL;
+ return nullptr;
}
- GpFont* pFont = NULL;
+ GpFont* pFont = nullptr;
status = CallFunc(GdipCreateFont)(family_list[0], font_size, fontstyle,
UnitPixel, &pFont);
if (status != Ok) {
- return NULL;
+ return nullptr;
}
return pFont;
}
@@ -922,7 +922,7 @@ FX_BOOL CGdiplusExt::StretchBitMask(HDC hDC,
ASSERT(pBitmap->GetBPP() == 1);
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
- GpGraphics* pGraphics = NULL;
+ GpGraphics* pGraphics = nullptr;
CallFunc(GdipCreateFromHDC)(hDC, &pGraphics);
CallFunc(GdipSetPageUnit)(pGraphics, UnitPixel);
if (flags & FXDIB_NOSMOOTH) {
@@ -980,7 +980,7 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState,
width = unit;
}
}
- GpPen* pPen = NULL;
+ GpPen* pPen = nullptr;
CallFunc(GdipCreatePen1)((ARGB)argb, width, UnitWorld, &pPen);
LineCap lineCap = LineCapFlat;
DashCap dashCap = DashCapFlat;
@@ -1066,7 +1066,7 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState,
}
CallFunc(GdipSetPenDashOffset)(pPen, phase);
FX_Free(pDashArray);
- pDashArray = NULL;
+ pDashArray = nullptr;
}
CallFunc(GdipSetPenMiterLimit)(pPen, pGraphState->m_MiterLimit);
return pPen;
@@ -1108,13 +1108,13 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC,
return TRUE;
}
FX_PATHPOINT* pPoints = pPathData->GetPoints();
- GpGraphics* pGraphics = NULL;
+ GpGraphics* pGraphics = nullptr;
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
CallFunc(GdipCreateFromHDC)(hDC, &pGraphics);
CallFunc(GdipSetPageUnit)(pGraphics, UnitPixel);
CallFunc(GdipSetPixelOffsetMode)(pGraphics, PixelOffsetModeHalf);
- GpMatrix* pMatrix = NULL;
+ GpMatrix* pMatrix = nullptr;
if (pObject2Device) {
CallFunc(GdipCreateMatrix2)(pObject2Device->a, pObject2Device->b,
pObject2Device->c, pObject2Device->d,
@@ -1201,7 +1201,7 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC,
if (nPoints == 4 && !pGraphState) {
int v1, v2;
if (IsSmallTriangle(points, pObject2Device, v1, v2)) {
- GpPen* pPen = NULL;
+ GpPen* pPen = nullptr;
CallFunc(GdipCreatePen1)(fill_argb, 1.0f, UnitPixel, &pPen);
CallFunc(GdipDrawLineI)(
pGraphics, pPen, FXSYS_round(points[v1].X), FXSYS_round(points[v1].Y),
@@ -1210,7 +1210,7 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC,
return TRUE;
}
}
- GpPath* pGpPath = NULL;
+ GpPath* pGpPath = nullptr;
CallFunc(GdipCreatePath2)(points, types, nPoints,
GdiFillType2Gdip(new_fill_mode), &pGpPath);
if (!pGpPath) {
@@ -1400,7 +1400,7 @@ typedef struct {
} PREVIEW3_DIBITMAP;
static PREVIEW3_DIBITMAP* LoadDIBitmap(WINDIB_Open_Args_ args) {
GpBitmap* pBitmap;
- GpStream* pStream = NULL;
+ GpStream* pStream = nullptr;
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
Status status = Ok;
@@ -1409,17 +1409,17 @@ static PREVIEW3_DIBITMAP* LoadDIBitmap(WINDIB_Open_Args_ args) {
&pBitmap);
} else {
if (args.memory_size == 0 || !args.memory_base) {
- return NULL;
+ return nullptr;
}
pStream = new GpStream;
- pStream->Write(args.memory_base, (ULONG)args.memory_size, NULL);
+ pStream->Write(args.memory_base, (ULONG)args.memory_size, nullptr);
status = CallFunc(GdipCreateBitmapFromStreamICM)(pStream, &pBitmap);
}
if (status != Ok) {
if (pStream) {
pStream->Release();
}
- return NULL;
+ return nullptr;
}
UINT height, width;
CallFunc(GdipGetImageHeight)(pBitmap, &height);
@@ -1495,7 +1495,7 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
CFX_DIBitmap* CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) {
PREVIEW3_DIBITMAP* pInfo = ::LoadDIBitmap(args);
if (!pInfo) {
- return NULL;
+ return nullptr;
}
int height = abs(pInfo->pbmi->bmiHeader.biHeight);
int width = pInfo->pbmi->bmiHeader.biWidth;
diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h
index 08253b33de..2143b76250 100644
--- a/core/fxge/win32/win32_int.h
+++ b/core/fxge/win32/win32_int.h
@@ -16,7 +16,7 @@ class CGdiplusExt {
CGdiplusExt();
~CGdiplusExt();
void Load();
- FX_BOOL IsAvailable() { return m_hModule != NULL; }
+ FX_BOOL IsAvailable() { return !!m_hModule; }
FX_BOOL StretchBitMask(HDC hDC,
BOOL bMonoDevice,
const CFX_DIBitmap* pBitmap,
@@ -188,7 +188,7 @@ class CGdiDisplayDriver : public CGdiDeviceDriver {
FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
int left,
int top,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
FX_BOOL bDEdge = FALSE) override;
FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
@@ -229,7 +229,7 @@ class CGdiDisplayDriver : public CGdiDeviceDriver {
const FX_RECT* pClipRect,
int render_flags,
int alpha_flag = 0,
- void* pIccTransform = NULL,
+ void* pIccTransform = nullptr,
int blend_type = FXDIB_BLEND_NORMAL);
};