diff options
author | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:34:00 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:34:00 -0800 |
commit | 412e908082a361d0fd9591eab939e96a882212f1 (patch) | |
tree | 11726052ae08f13dc5a05a82cbce870758580aeb /core/src/fxge/win32/fx_win32_dib.cpp | |
parent | 96660d6f382204339d6b1aadc3913303d436e252 (diff) | |
download | pdfium-412e908082a361d0fd9591eab939e96a882212f1.tar.xz |
Merge to XFA: Get rid of most instance of 'foo == NULL'
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1520063002 .
(cherry picked from commit e385244f8cd6ae376f6b3cf1265a0795d5d30eff)
Review URL: https://codereview.chromium.org/1528763003 .
Diffstat (limited to 'core/src/fxge/win32/fx_win32_dib.cpp')
-rw-r--r-- | core/src/fxge/win32/fx_win32_dib.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp index 1aa60f084e..1fdf3ae9b1 100644 --- a/core/src/fxge/win32/fx_win32_dib.cpp +++ b/core/src/fxge/win32/fx_win32_dib.cpp @@ -28,24 +28,24 @@ CFX_ByteString CFX_WindowsDIB::GetBitmapInfo(const CFX_DIBitmap* pBitmap) { pbmih->biWidth = pBitmap->GetWidth(); if (pBitmap->GetBPP() == 8) { FX_DWORD* pPalette = (FX_DWORD*)(pbmih + 1); - if (pBitmap->GetPalette() == NULL) { + if (pBitmap->GetPalette()) { for (int i = 0; i < 256; i++) { - pPalette[i] = i * 0x010101; + pPalette[i] = pBitmap->GetPalette()[i]; } } else { for (int i = 0; i < 256; i++) { - pPalette[i] = pBitmap->GetPalette()[i]; + pPalette[i] = i * 0x010101; } } } if (pBitmap->GetBPP() == 1) { FX_DWORD* pPalette = (FX_DWORD*)(pbmih + 1); - if (pBitmap->GetPalette() == NULL) { - pPalette[0] = 0; - pPalette[1] = 0xffffff; - } else { + if (pBitmap->GetPalette()) { pPalette[0] = pBitmap->GetPalette()[0]; pPalette[1] = pBitmap->GetPalette()[1]; + } else { + pPalette[0] = 0; + pPalette[1] = 0xffffff; } } result.ReleaseBuffer(len); @@ -125,7 +125,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_WCHAR* filename) { } HBITMAP hBitmap = (HBITMAP)LoadImageW(NULL, (wchar_t*)filename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); - if (hBitmap == NULL) { + if (!hBitmap) { return NULL; } HDC hDC = CreateCompatibleDC(NULL); @@ -158,7 +158,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) { } HBITMAP hBitmap = (HBITMAP)LoadImageW(NULL, (wchar_t*)args.path_name, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); - if (hBitmap == NULL) { + if (!hBitmap) { return NULL; } HDC hDC = CreateCompatibleDC(NULL); @@ -184,8 +184,8 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pPalette, FX_DWORD palsize) { - FX_BOOL bCreatedDC = hDC == NULL; - if (hDC == NULL) { + FX_BOOL bCreatedDC = !hDC; + if (bCreatedDC) { hDC = CreateCompatibleDC(NULL); } BITMAPINFOHEADER bmih; |