From 007e6c0f9559412788b903bcb6a7601e220c3be8 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 26 Feb 2016 14:31:56 -0800 Subject: Remove some FX_BOOLs Grepping for FX_BOOL and |==| on the same line gives a very strong clue that the expression won't be out of range of the |bool| type iteself. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1736323003 . --- core/src/fxge/android/fpf_skiafontmgr.cpp | 4 ++-- core/src/fxge/dib/fx_dib_composite.cpp | 2 +- core/src/fxge/ge/fx_ge_text.cpp | 4 ++-- core/src/fxge/win32/fx_win32_device.cpp | 3 +-- 4 files changed, 6 insertions(+), 7 deletions(-) (limited to 'core/src/fxge') diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index 2d4a2c726b..b37343b9e5 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -280,7 +280,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, if (dwFaceName == dwSysFontName) { nFind += FPF_SKIAMATCHWEIGHT_NAME1; } - FX_BOOL bMatchedName = (nFind == FPF_SKIAMATCHWEIGHT_NAME1); + bool bMatchedName = (nFind == FPF_SKIAMATCHWEIGHT_NAME1); if ((dwStyle & FXFONT_BOLD) == (pFontDes->m_dwStyle & FXFONT_BOLD)) { nFind += FPF_SKIAMATCHWEIGHT_1; } @@ -299,7 +299,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, } if (dwSubst == dwSysFontName || dwSubstSans == dwSysFontName) { nFind += FPF_SKIAMATCHWEIGHT_NAME2; - bMatchedName = TRUE; + bMatchedName = true; } if (uCharset == FXFONT_DEFAULT_CHARSET || bMaybeSymbol) { if (nFind > nMax && bMatchedName) { diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp index 6068dffe75..8bf36e523a 100644 --- a/core/src/fxge/dib/fx_dib_composite.cpp +++ b/core/src/fxge/dib/fx_dib_composite.cpp @@ -4907,7 +4907,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, } int Bpp = m_bpp / 8; FX_BOOL bAlpha = HasAlpha(); - FX_BOOL bArgb = GetFormat() == FXDIB_Argb; + bool bArgb = GetFormat() == FXDIB_Argb; if (src_alpha == 255) { for (int row = rect.top; row < rect.bottom; row++) { uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index ae426b093c..8d54363d14 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -1173,7 +1173,7 @@ CFX_FontCache::~CFX_FontCache() { CFX_FaceCache* CFX_FontCache::GetCachedFace(CFX_Font* pFont) { FXFT_Face internal_face = pFont->GetFace(); - const FX_BOOL bExternal = internal_face == nullptr; + const bool bExternal = !internal_face; FXFT_Face face = bExternal ? (FXFT_Face)pFont->GetSubstFont()->m_ExtHandle : internal_face; CFX_FTCacheMap& map = bExternal ? m_ExtFaceMap : m_FTFaceMap; @@ -1194,7 +1194,7 @@ CFX_FaceCache* CFX_FontCache::GetCachedFace(CFX_Font* pFont) { void CFX_FontCache::ReleaseCachedFace(CFX_Font* pFont) { FXFT_Face internal_face = pFont->GetFace(); - const FX_BOOL bExternal = internal_face == nullptr; + const bool bExternal = !internal_face; FXFT_Face face = bExternal ? (FXFT_Face)pFont->GetSubstFont()->m_ExtHandle : internal_face; CFX_FTCacheMap& map = bExternal ? m_ExtFaceMap : m_FTFaceMap; diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index 58f8769ac7..e9fee082b9 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -1103,8 +1103,7 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, int alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); - FX_BOOL bGDI = pSource->GetBPP() == 1 && alpha == 255; - if (!bGDI) { + if (pSource->GetBPP() != 1 || alpha != 255) { CFX_DIBitmap background; if (!background.Create(width, height, FXDIB_Rgb32) || !GetDIBits(&background, left, top, NULL) || -- cgit v1.2.3