Chromium Code Reviews| Index: core/fxge/win32/fx_win32_dib.cpp |
| diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp |
| index eefa991eebd3058885bc0f93968f71b9625f847f..95bdc8c61b79b6d42bf1a492430f1ac99fca6e5a 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,7 +102,7 @@ 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 hBitmap = nullptr; |
|
Tom Sepez
2016/06/02 20:09:50
combine.
Lei Zhang
2016/06/07 07:33:24
Done.
|
| hBitmap = CreateDIBitmap(hDC, (BITMAPINFOHEADER*)info.c_str(), CBM_INIT, |
| pBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), |
| DIB_RGB_COLORS); |
| @@ -123,26 +123,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 +154,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 +186,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 +218,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 +237,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 +254,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, |
| } |
| if (ret == 0) { |
| delete pDIBitmap; |
| - pDIBitmap = NULL; |
| + pDIBitmap = nullptr; |
| } |
| if (bCreatedDC) { |
| DeleteDC(hDC); |
| @@ -271,7 +271,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); |
| } |