summaryrefslogtreecommitdiff
path: root/core/fxge/dib
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-06-07 10:46:22 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-07 10:46:23 -0700
commit4997b22f84307521a62838f874928bf56cd3423c (patch)
treead11d99ac0a491ee222e9d0a42ec3b6ad3354e2a /core/fxge/dib
parent0687e76dc259c678b3f29a6608331f07ffd8f1e2 (diff)
downloadpdfium-4997b22f84307521a62838f874928bf56cd3423c.tar.xz
Get rid of NULLs in core/
Review-Url: https://codereview.chromium.org/2032613003
Diffstat (limited to 'core/fxge/dib')
-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
5 files changed, 54 insertions, 54 deletions
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();