diff options
author | tsepez <tsepez@chromium.org> | 2016-05-13 17:51:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-13 17:51:27 -0700 |
commit | 71a452f8ce12e31cc4e0d8c7878567b0c7fc63c2 (patch) | |
tree | a0ee545eb67b14f9398df98196d88e5150893ce8 /core/fxge | |
parent | afe94306e3c542f0d499e7f7706ee5dec4028d8a (diff) | |
download | pdfium-71a452f8ce12e31cc4e0d8c7878567b0c7fc63c2.tar.xz |
Make CFX_ByteString(const CFX_ByteStringC&) explicit.
Add missing helper function to CFX_ByteTextBuf to avoid the
anti-pattern CFX_ByteString(sBuf.AsStringC()), using the name
"Make" to indicate there's an allocation going on in this case.
Change some method arguments to take pre-existing ByteStrings where
possible.
Review-Url: https://codereview.chromium.org/1977093002
Diffstat (limited to 'core/fxge')
-rw-r--r-- | core/fxge/ge/fx_ge_fontmap.cpp | 11 | ||||
-rw-r--r-- | core/fxge/ge/fx_ge_text.cpp | 6 | ||||
-rw-r--r-- | core/fxge/include/fx_font.h | 2 |
3 files changed, 11 insertions, 8 deletions
diff --git a/core/fxge/ge/fx_ge_fontmap.cpp b/core/fxge/ge/fx_ge_fontmap.cpp index 8524660043..e8af2dce53 100644 --- a/core/fxge/ge/fx_ge_fontmap.cpp +++ b/core/fxge/ge/fx_ge_fontmap.cpp @@ -317,7 +317,7 @@ CFX_ByteString GetFontFamily(CFX_ByteString fontName, int nStyle) { CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) { CFX_ByteTextBuf buf; if (!iLen || iLen <= iIndex) { - return buf.AsStringC(); + return buf.MakeString(); } while (iIndex < iLen) { if (pStyle[iIndex] == ',') { @@ -326,7 +326,7 @@ CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) { buf.AppendChar(pStyle[iIndex]); ++iIndex; } - return buf.AsStringC(); + return buf.MakeString(); } int32_t GetStyleType(const CFX_ByteString& bsStyle, FX_BOOL bRevert) { @@ -688,7 +688,7 @@ static CFX_ByteString GetStringFromTable(const uint8_t* string_ptr, if (string_ptr_length < static_cast<uint32_t>(offset + length)) { return CFX_ByteString(); } - return CFX_ByteStringC(string_ptr + offset, length); + return CFX_ByteString(string_ptr + offset, length); } CFX_ByteString GetNameFromTT(const uint8_t* name_table, @@ -1368,12 +1368,15 @@ CFX_FolderFontInfo::~CFX_FolderFontInfo() { delete pair.second; } } + void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) { - m_PathList.push_back(path); + m_PathList.push_back(CFX_ByteString(path)); } + void CFX_FolderFontInfo::Release() { delete this; } + FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) { m_pMapper = pMapper; for (const auto& path : m_PathList) diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp index 3372b7f95d..b0f6a6e63a 100644 --- a/core/fxge/ge/fx_ge_text.cpp +++ b/core/fxge/ge/fx_ge_text.cpp @@ -1288,7 +1288,7 @@ void CFX_FaceCache::InitPlatform() {} CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap( CFX_Font* pFont, const CFX_Matrix* pMatrix, - CFX_ByteStringC& FaceGlyphsKey, + const CFX_ByteString& FaceGlyphsKey, uint32_t glyph_index, FX_BOOL bFontStyle, int dest_width, @@ -1359,7 +1359,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, dest_width, anti_alias, 3); } #endif - CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); + CFX_ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontStyle, dest_width, anti_alias); @@ -1401,7 +1401,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), dest_width, anti_alias); - CFX_ByteStringC FaceGlyphsKey2(keygen.m_Key, keygen.m_KeyLen); + CFX_ByteString FaceGlyphsKey2(keygen.m_Key, keygen.m_KeyLen); text_flags |= FXTEXT_NO_NATIVETEXT; return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey2, glyph_index, bFontStyle, dest_width, anti_alias); diff --git a/core/fxge/include/fx_font.h b/core/fxge/include/fx_font.h index 02ab44d6b8..dad10f2ccb 100644 --- a/core/fxge/include/fx_font.h +++ b/core/fxge/include/fx_font.h @@ -501,7 +501,7 @@ class CFX_FaceCache { int anti_alias); CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, const CFX_Matrix* pMatrix, - CFX_ByteStringC& FaceGlyphsKey, + const CFX_ByteString& FaceGlyphsKey, uint32_t glyph_index, FX_BOOL bFontStyle, int dest_width, |