summaryrefslogtreecommitdiff
path: root/core/fxge/apple
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge/apple')
-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
4 files changed, 55 insertions, 54 deletions
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);