summaryrefslogtreecommitdiff
path: root/core/src/fxge/android
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-27 12:08:12 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-27 12:08:12 -0700
commit8d2aae7ee320da3a8ffe01c57e38b3f98443257d (patch)
treee694c6f82ec72fa46e6172b4475996b30d3f6a3a /core/src/fxge/android
parentff46aaf499edcf153ee2f57c7016587aa96dcfa0 (diff)
downloadpdfium-8d2aae7ee320da3a8ffe01c57e38b3f98443257d.tar.xz
Revert "FX Bool considered harmful, part 3"
This reverts commit ff46aaf499edcf153ee2f57c7016587aa96dcfa0. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1255293002 .
Diffstat (limited to 'core/src/fxge/android')
-rw-r--r--core/src/fxge/android/fpf_skiafont.cpp30
-rw-r--r--core/src/fxge/android/fpf_skiafont.h6
-rw-r--r--core/src/fxge/android/fpf_skiafontmgr.cpp28
-rw-r--r--core/src/fxge/android/fpf_skiafontmgr.h4
-rw-r--r--core/src/fxge/android/fx_android_font.cpp24
-rw-r--r--core/src/fxge/android/fx_android_font.h10
6 files changed, 51 insertions, 51 deletions
diff --git a/core/src/fxge/android/fpf_skiafont.cpp b/core/src/fxge/android/fpf_skiafont.cpp
index f5ac6c0ce6..2dad01057a 100644
--- a/core/src/fxge/android/fpf_skiafont.cpp
+++ b/core/src/fxge/android/fpf_skiafont.cpp
@@ -87,23 +87,23 @@ int32_t CFPF_SkiaFont::GetDescent() const
}
return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_Descender(m_Face));
}
-bool CFPF_SkiaFont::GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox)
+FX_BOOL CFPF_SkiaFont::GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox)
{
if (!m_Face) {
- return false;
+ return FALSE;
}
if (FXFT_Is_Face_Tricky(m_Face)) {
if (FXFT_Set_Char_Size(m_Face, 0, 1000 * 64, 72, 72)) {
- return false;
+ return FALSE;
}
if (FXFT_Load_Glyph(m_Face, iGlyphIndex, FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
- return false;
+ return FALSE;
}
FXFT_Glyph glyph;
if (FXFT_Get_Glyph(m_Face->glyph, &glyph)) {
FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
- return false;
+ return FALSE;
}
FXFT_BBox cbox;
FXFT_Glyph_Get_CBox(glyph, FXFT_GLYPH_BBOX_PIXELS, &cbox);
@@ -119,24 +119,24 @@ bool CFPF_SkiaFont::GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox)
return FXFT_Set_Pixel_Sizes(m_Face, 0, 64) == 0;
}
if (FXFT_Load_Glyph(m_Face, iGlyphIndex, FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
- return false;
+ return FALSE;
}
rtBBox.left = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriBearingX(m_Face));
rtBBox.bottom = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriBearingY(m_Face));
rtBBox.right = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriBearingX(m_Face) + FXFT_Get_Glyph_Width(m_Face));
rtBBox.top = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriBearingY(m_Face) - FXFT_Get_Glyph_Height(m_Face));
- return true;
+ return TRUE;
}
-bool CFPF_SkiaFont::GetBBox(FX_RECT &rtBBox)
+FX_BOOL CFPF_SkiaFont::GetBBox(FX_RECT &rtBBox)
{
if (!m_Face) {
- return false;
+ return FALSE;
}
rtBBox.left = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_xMin(m_Face));
rtBBox.top = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_yMin(m_Face));
rtBBox.right = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_xMax(m_Face));
rtBBox.bottom = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_yMax(m_Face));
- return true;
+ return TRUE;
}
int32_t CFPF_SkiaFont::GetHeight() const
{
@@ -167,10 +167,10 @@ FX_DWORD CFPF_SkiaFont::GetFontData(FX_DWORD dwTable, uint8_t* pBuffer, FX_DWORD
}
return pdfium::base::checked_cast<FX_DWORD>(ulSize);
}
-bool CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, const CFX_ByteStringC& bsFamily, FX_DWORD dwStyle, uint8_t uCharset)
+FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, const CFX_ByteStringC& bsFamily, FX_DWORD dwStyle, uint8_t uCharset)
{
if (!pFontMgr || !pFontDes) {
- return false;
+ return FALSE;
}
switch (pFontDes->GetType()) {
case FPF_SKIAFONTTYPE_Path: {
@@ -189,16 +189,16 @@ bool CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor
}
break;
default:
- return false;
+ return FALSE;
}
if (!m_Face) {
- return false;
+ return FALSE;
}
m_dwStyle = dwStyle;
m_uCharset = uCharset;
m_pFontMgr = pFontMgr;
m_pFontDes = pFontDes;
m_dwRefCount = 1;
- return true;
+ return TRUE;
}
#endif
diff --git a/core/src/fxge/android/fpf_skiafont.h b/core/src/fxge/android/fpf_skiafont.h
index 90cf5cb29c..49819d4c11 100644
--- a/core/src/fxge/android/fpf_skiafont.h
+++ b/core/src/fxge/android/fpf_skiafont.h
@@ -39,13 +39,13 @@ public:
virtual int32_t GetAscent() const;
virtual int32_t GetDescent() const;
- virtual bool GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox);
- virtual bool GetBBox(FX_RECT &rtBBox);
+ virtual FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT &rtBBox);
+ virtual FX_BOOL GetBBox(FX_RECT &rtBBox);
virtual int32_t GetHeight() const;
virtual int32_t GetItalicAngle() const;
virtual FX_DWORD GetFontData(FX_DWORD dwTable, uint8_t* pBuffer, FX_DWORD dwSize);
- bool InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, const CFX_ByteStringC& bsFamily, FX_DWORD dwStyle, uint8_t uCharset);
+ FX_BOOL InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, const CFX_ByteStringC& bsFamily, FX_DWORD dwStyle, uint8_t uCharset);
protected:
CFPF_SkiaFontMgr *m_pFontMgr;
CFPF_SkiaFontDescriptor *m_pFontDes;
diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp
index 8c835392fc..86bb052435 100644
--- a/core/src/fxge/android/fpf_skiafontmgr.cpp
+++ b/core/src/fxge/android/fpf_skiafontmgr.cpp
@@ -103,7 +103,7 @@ FX_DWORD FPF_SkiaGetSansFont(FX_DWORD dwHash)
}
return 0;
}
-static uint32_t FPF_GetHashCode_StringA(const FX_CHAR* pStr, int32_t iLength, bool bIgnoreCase = false)
+static uint32_t FPF_GetHashCode_StringA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE)
{
if (!pStr) {
return 0;
@@ -208,27 +208,27 @@ static FX_DWORD FPF_SKIAGetFamilyHash(const CFX_ByteStringC& bsFamily, FX_DWORD
bsFont += "Serif";
}
bsFont += uCharset;
- return FPF_GetHashCode_StringA(bsFont.c_str(), bsFont.GetLength(), true);
+ return FPF_GetHashCode_StringA(bsFont.c_str(), bsFont.GetLength(), TRUE);
}
-static bool FPF_SkiaIsCJK(uint8_t uCharset)
+static FX_BOOL FPF_SkiaIsCJK(uint8_t uCharset)
{
return (uCharset == FXFONT_GB2312_CHARSET) || (uCharset == FXFONT_CHINESEBIG5_CHARSET)
|| (uCharset == FXFONT_HANGEUL_CHARSET) || (uCharset == FXFONT_SHIFTJIS_CHARSET);
}
-static bool FPF_SkiaMaybeSymbol(const CFX_ByteStringC& bsFacename)
+static FX_BOOL FPF_SkiaMaybeSymbol(const CFX_ByteStringC& bsFacename)
{
CFX_ByteString bsName = bsFacename;
bsName.MakeLower();
return bsName.Find("symbol") > -1;
}
-static bool FPF_SkiaMaybeArabic(const CFX_ByteStringC& bsFacename)
+static FX_BOOL FPF_SkiaMaybeArabic(const CFX_ByteStringC& bsFacename)
{
CFX_ByteString bsName = bsFacename;
bsName.MakeLower();
return bsName.Find("arabic") > -1;
}
CFPF_SkiaFontMgr::CFPF_SkiaFontMgr()
- : m_bLoaded(false), m_FTLibrary(NULL)
+ : m_bLoaded(FALSE), m_FTLibrary(NULL)
{
}
CFPF_SkiaFontMgr::~CFPF_SkiaFontMgr()
@@ -252,7 +252,7 @@ CFPF_SkiaFontMgr::~CFPF_SkiaFontMgr()
FXFT_Done_FreeType(m_FTLibrary);
}
}
-bool CFPF_SkiaFontMgr::InitFTLibrary()
+FX_BOOL CFPF_SkiaFontMgr::InitFTLibrary()
{
if (m_FTLibrary == NULL) {
FXFT_Init_FreeType(&m_FTLibrary);
@@ -266,7 +266,7 @@ void CFPF_SkiaFontMgr::LoadSystemFonts()
}
ScanPath(FX_BSTRC("/system/fonts"));
OutputSystemFonts();
- m_bLoaded = true;
+ m_bLoaded = TRUE;
}
void CFPF_SkiaFontMgr::LoadPrivateFont(IFX_FileRead* pFontFile)
{
@@ -289,7 +289,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, uin
FX_DWORD dwFaceName = FPF_SKIANormalizeFontName(bsFamilyname);
FX_DWORD dwSubst = FPF_SkiaGetSubstFont(dwFaceName);
FX_DWORD dwSubstSans = FPF_SkiaGetSansFont(dwFaceName);
- bool bMaybeSymbol = FPF_SkiaMaybeSymbol(bsFamilyname);
+ FX_BOOL bMaybeSymbol = FPF_SkiaMaybeSymbol(bsFamilyname);
if (uCharset != FXFONT_ARABIC_CHARSET && FPF_SkiaMaybeArabic(bsFamilyname)) {
uCharset = FXFONT_ARABIC_CHARSET;
} else if (uCharset == FXFONT_ANSI_CHARSET && (dwMatch & FPF_MATCHFONT_REPLACEANSI)) {
@@ -309,7 +309,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, uin
if (dwFaceName == dwSysFontName) {
nFind += FPF_SKIAMATCHWEIGHT_NAME1;
}
- bool bMatchedName = (nFind == FPF_SKIAMATCHWEIGHT_NAME1);
+ FX_BOOL bMatchedName = (nFind == FPF_SKIAMATCHWEIGHT_NAME1);
if ((dwStyle & FXFONT_BOLD) == (pFontDes->m_dwStyle & FXFONT_BOLD)) {
nFind += FPF_SKIAMATCHWEIGHT_1;
}
@@ -327,7 +327,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, uin
}
if (dwSubst == dwSysFontName || dwSubstSans == dwSysFontName) {
nFind += FPF_SKIAMATCHWEIGHT_NAME2;
- bMatchedName = true;
+ bMatchedName = TRUE;
}
if (uCharset == FXFONT_DEFAULT_CHARSET || bMaybeSymbol) {
if (nFind > nMax && bMatchedName) {
@@ -399,7 +399,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const CFX_ByteStringC& bsFile, int32_t i
args.pathname = (FT_String*)bsFile.GetCStr();
FXFT_Face face;
if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) {
- return false;
+ return FALSE;
}
FXFT_Set_Pixel_Sizes(face, 0, 64);
return face;
@@ -418,7 +418,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const uint8_t* pBuffer, size_t szBuffer,
args.memory_size = szBuffer;
FXFT_Face face;
if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) {
- return false;
+ return FALSE;
}
FXFT_Set_Pixel_Sizes(face, 0, 64);
return face;
@@ -430,7 +430,7 @@ void CFPF_SkiaFontMgr::ScanPath(const CFX_ByteStringC& path)
return;
}
CFX_ByteString filename;
- bool bFolder = false;
+ FX_BOOL bFolder = FALSE;
while (FX_GetNextFile(handle, filename, bFolder)) {
if (bFolder) {
if (filename == FX_BSTRC(".") || filename == FX_BSTRC("..")) {
diff --git a/core/src/fxge/android/fpf_skiafontmgr.h b/core/src/fxge/android/fpf_skiafontmgr.h
index b4ebe9454a..8c721ff68a 100644
--- a/core/src/fxge/android/fpf_skiafontmgr.h
+++ b/core/src/fxge/android/fpf_skiafontmgr.h
@@ -94,7 +94,7 @@ class CFPF_SkiaFontMgr : public IFPF_FontMgr
public:
CFPF_SkiaFontMgr();
virtual ~CFPF_SkiaFontMgr();
- bool InitFTLibrary();
+ FX_BOOL InitFTLibrary();
virtual void LoadSystemFonts();
virtual void LoadPrivateFont(IFX_FileRead* pFontFile);
virtual void LoadPrivateFont(const CFX_ByteStringC& bsFileName);
@@ -109,7 +109,7 @@ protected:
void ScanFile(const CFX_ByteStringC& file);
void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor *pFontDesc);
void OutputSystemFonts();
- bool m_bLoaded;
+ FX_BOOL m_bLoaded;
CFX_PtrArray m_FontFaces;
FXFT_Library m_FTLibrary;
CFX_MapPtrToPtr m_FamilyFonts;
diff --git a/core/src/fxge/android/fx_android_font.cpp b/core/src/fxge/android/fx_android_font.cpp
index 4f2bc15b2a..3e2fc45854 100644
--- a/core/src/fxge/android/fx_android_font.cpp
+++ b/core/src/fxge/android/fx_android_font.cpp
@@ -10,20 +10,20 @@ CFX_AndroidFontInfo::CFX_AndroidFontInfo()
: m_pFontMgr(NULL)
{
}
-bool CFX_AndroidFontInfo::Init(IFPF_FontMgr *pFontMgr)
+FX_BOOL CFX_AndroidFontInfo::Init(IFPF_FontMgr *pFontMgr)
{
if (!pFontMgr) {
- return false;
+ return FALSE;
}
pFontMgr->LoadSystemFonts();
m_pFontMgr = pFontMgr;
- return true;
+ return TRUE;
}
-bool CFX_AndroidFontInfo::EnumFontList(CFX_FontMapper* pMapper)
+FX_BOOL CFX_AndroidFontInfo::EnumFontList(CFX_FontMapper* pMapper)
{
- return false;
+ return FALSE;
}
-void* CFX_AndroidFontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_family, const FX_CHAR* face, bool& bExact)
+void* CFX_AndroidFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact)
{
if (!m_pFontMgr) {
return NULL;
@@ -57,21 +57,21 @@ FX_DWORD CFX_AndroidFontInfo::GetFontData(void* hFont, FX_DWORD table, uint8_t*
}
return ((IFPF_Font*)hFont)->GetFontData(table, buffer, size);
}
-bool CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString& name)
+FX_BOOL CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString& name)
{
if (!hFont) {
- return false;
+ return FALSE;
}
name = ((IFPF_Font*)hFont)->GetFamilyName();
- return true;
+ return TRUE;
}
-bool CFX_AndroidFontInfo::GetFontCharset(void* hFont, int& charset)
+FX_BOOL CFX_AndroidFontInfo::GetFontCharset(void* hFont, int& charset)
{
if (!hFont) {
- return false;
+ return FALSE;
}
charset = ((IFPF_Font*)hFont)->GetCharset();
- return false;
+ return FALSE;
}
void CFX_AndroidFontInfo::DeleteFont(void* hFont)
{
diff --git a/core/src/fxge/android/fx_android_font.h b/core/src/fxge/android/fx_android_font.h
index 075b79e7f2..83c04a03a4 100644
--- a/core/src/fxge/android/fx_android_font.h
+++ b/core/src/fxge/android/fx_android_font.h
@@ -18,18 +18,18 @@ public:
delete this;
}
- virtual bool EnumFontList(CFX_FontMapper* pMapper);
+ virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper);
- virtual void* MapFont(int weight, bool bItalic, int charset, int pitch_family, const FX_CHAR* face, bool& bExact);
+ virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact);
virtual void* GetFont(const FX_CHAR* face);
virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size);
- virtual bool GetFaceName(void* hFont, CFX_ByteString& name);
- virtual bool GetFontCharset(void* hFont, int& charset);
+ virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name);
+ virtual FX_BOOL GetFontCharset(void* hFont, int& charset);
virtual void DeleteFont(void* hFont);
virtual void* RetainFont(void* hFont);
- bool Init(IFPF_FontMgr *pFontMgr);
+ FX_BOOL Init(IFPF_FontMgr *pFontMgr);
protected:
IFPF_FontMgr *m_pFontMgr;
};