diff options
author | thestig <thestig@chromium.org> | 2016-06-07 10:46:22 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-07 10:46:23 -0700 |
commit | 4997b22f84307521a62838f874928bf56cd3423c (patch) | |
tree | ad11d99ac0a491ee222e9d0a42ec3b6ad3354e2a /core/fxge/win32 | |
parent | 0687e76dc259c678b3f29a6608331f07ffd8f1e2 (diff) | |
download | pdfium-4997b22f84307521a62838f874928bf56cd3423c.tar.xz |
Get rid of NULLs in core/
Review-Url: https://codereview.chromium.org/2032613003
Diffstat (limited to 'core/fxge/win32')
-rw-r--r-- | core/fxge/win32/dwrite_int.h | 2 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_dib.cpp | 50 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_dwrite.cpp | 50 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_gdipext.cpp | 60 | ||||
-rw-r--r-- | core/fxge/win32/win32_int.h | 6 |
5 files changed, 83 insertions, 85 deletions
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); }; |