From ff46aaf499edcf153ee2f57c7016587aa96dcfa0 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 27 Jul 2015 11:55:29 -0700 Subject: FX Bool considered harmful, part 3 Try to reland this patch after fixing underlying issues that caused it to be reverted. fx_system.h is the only manual edit. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1258093002 . --- core/src/fpdfdoc/doc_utils.cpp | 54 +++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'core/src/fpdfdoc/doc_utils.cpp') diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp index 96d2ccf689..26c93f1791 100644 --- a/core/src/fpdfdoc/doc_utils.cpp +++ b/core/src/fpdfdoc/doc_utils.cpp @@ -26,10 +26,10 @@ CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict) } return full_name; } -FX_BOOL CPDF_DefaultAppearance::HasFont() +bool CPDF_DefaultAppearance::HasFont() { if (m_csDA.IsEmpty()) { - return FALSE; + return false; } CPDF_SimpleParser syntax(m_csDA); return syntax.FindTagParam("Tf", 2); @@ -65,23 +65,23 @@ void CPDF_DefaultAppearance::GetFont(CFX_ByteString& csFontNameTag, FX_FLOAT& fF } csFontNameTag = PDF_NameDecode(csFontNameTag); } -FX_BOOL CPDF_DefaultAppearance::HasColor(FX_BOOL bStrokingOperation) +bool CPDF_DefaultAppearance::HasColor(bool bStrokingOperation) { if (m_csDA.IsEmpty()) { - return FALSE; + return false; } CPDF_SimpleParser syntax(m_csDA); if (syntax.FindTagParam(bStrokingOperation ? "G" : "g", 1)) { - return TRUE; + return true; } syntax.SetPos(0); if (syntax.FindTagParam(bStrokingOperation ? "RG" : "rg", 3)) { - return TRUE; + return true; } syntax.SetPos(0); return syntax.FindTagParam(bStrokingOperation ? "K" : "k", 4); } -CFX_ByteString CPDF_DefaultAppearance::GetColorString(FX_BOOL bStrokingOperation) +CFX_ByteString CPDF_DefaultAppearance::GetColorString(bool bStrokingOperation) { CFX_ByteString csColor; if (m_csDA.IsEmpty()) { @@ -119,7 +119,7 @@ CFX_ByteString CPDF_DefaultAppearance::GetColorString(FX_BOOL bStrokingOperation } return csColor; } -void CPDF_DefaultAppearance::GetColor(int& iColorType, FX_FLOAT fc[4], FX_BOOL bStrokingOperation) +void CPDF_DefaultAppearance::GetColor(int& iColorType, FX_FLOAT fc[4], bool bStrokingOperation) { iColorType = COLORTYPE_TRANSPARENT; for (int c = 0; c < 4; c ++) { @@ -151,7 +151,7 @@ void CPDF_DefaultAppearance::GetColor(int& iColorType, FX_FLOAT fc[4], FX_BOOL b fc[3] = FX_atof((CFX_ByteString)syntax.GetWord()); } } -void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, int& iColorType, FX_BOOL bStrokingOperation) +void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, int& iColorType, bool bStrokingOperation) { color = 0; iColorType = COLORTYPE_TRANSPARENT; @@ -187,10 +187,10 @@ void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, int& iColorType, FX_BOOL b color = ArgbEncode(255, (int)(r * 255 + 0.5f), (int)(g * 255 + 0.5f), (int)(b * 255 + 0.5f)); } } -FX_BOOL CPDF_DefaultAppearance::HasTextMatrix() +bool CPDF_DefaultAppearance::HasTextMatrix() { if (m_csDA.IsEmpty()) { - return FALSE; + return false; } CPDF_SimpleParser syntax(m_csDA); return syntax.FindTagParam("Tm", 6); @@ -468,18 +468,18 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDo } return GetNativeInterFormFont(pFormDict, pDocument, charSet, csNameTag); } -FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_ByteString& csNameTag) +bool FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_ByteString& csNameTag) { if (pFormDict == NULL || pFont == NULL) { - return FALSE; + return false; } CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); if (pDR == NULL) { - return FALSE; + return false; } CPDF_Dictionary* pFonts = pDR->GetDict("Font"); if (pFonts == NULL) { - return FALSE; + return false; } FX_POSITION pos = pFonts->GetStartPos(); while (pos) { @@ -499,23 +499,23 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CF } if (pFont->GetFontDict() == pElement) { csNameTag = csKey; - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag) +bool FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag) { if (pFormDict == NULL) { - return FALSE; + return false; } CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); if (pDR == NULL) { - return FALSE; + return false; } CPDF_Dictionary* pFonts = pDR->GetDict("Font"); if (pFonts == NULL) { - return FALSE; + return false; } if (csFontName.GetLength() > 0) { csFontName.Remove(' '); @@ -545,10 +545,10 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, csBaseFont.Remove(' '); if (csBaseFont == csFontName) { csNameTag = csKey; - return TRUE; + return true; } } - return FALSE; + return false; } void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, const CPDF_Font* pFont, CFX_ByteString& csNameTag) { @@ -670,10 +670,10 @@ CPDF_IconFit::ScaleMethod CPDF_IconFit::GetScaleMethod() } return Always; } -FX_BOOL CPDF_IconFit::IsProportionalScale() +bool CPDF_IconFit::IsProportionalScale() { if (m_pDict == NULL) { - return TRUE; + return true; } return m_pDict->GetString("S", "P") != "A"; } @@ -694,10 +694,10 @@ void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) } } } -FX_BOOL CPDF_IconFit::GetFittingBounds() +bool CPDF_IconFit::GetFittingBounds() { if (m_pDict == NULL) { - return FALSE; + return false; } return m_pDict->GetBoolean("FB"); } -- cgit v1.2.3