summaryrefslogtreecommitdiff
path: root/core/fxge/android/cfpf_skiafont.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-17 23:51:08 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-17 23:51:08 +0000
commit2f113cac5ff28008c702898f41e691c8d233db5f (patch)
treeac5f32f69105a716e05efe8565f9dc1e24313868 /core/fxge/android/cfpf_skiafont.cpp
parent3f9a65a6bc254008625d6641ff9c54a40a64fb70 (diff)
downloadpdfium-2f113cac5ff28008c702898f41e691c8d233db5f.tar.xz
Get rid of CFPF_SkiaFont::InitFont().
Initialize via the ctor instead. Also fix refcounting for the class, so the refcount does not go negative for invalid fonts. Change-Id: I5cf51ae9051f5fc5e0204193d18f8eb37b34c244 Reviewed-on: https://pdfium-review.googlesource.com/40590 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxge/android/cfpf_skiafont.cpp')
-rw-r--r--core/fxge/android/cfpf_skiafont.cpp30
1 files changed, 9 insertions, 21 deletions
diff --git a/core/fxge/android/cfpf_skiafont.cpp b/core/fxge/android/cfpf_skiafont.cpp
index 242ddfd3bb..2d9f274219 100644
--- a/core/fxge/android/cfpf_skiafont.cpp
+++ b/core/fxge/android/cfpf_skiafont.cpp
@@ -15,7 +15,15 @@
#define FPF_EM_ADJUST(em, a) (em == 0 ? (a) : (a)*1000 / em)
-CFPF_SkiaFont::CFPF_SkiaFont() = default;
+CFPF_SkiaFont::CFPF_SkiaFont(CFPF_SkiaFontMgr* pFontMgr,
+ const CFPF_SkiaPathFont* pFont,
+ uint32_t dwStyle,
+ uint8_t uCharset)
+ : m_pFontMgr(pFontMgr),
+ m_pFont(pFont),
+ m_Face(m_pFontMgr->GetFontFace(m_pFont->path(), m_pFont->face_index())),
+ m_dwStyle(dwStyle),
+ m_uCharset(uCharset) {}
CFPF_SkiaFont::~CFPF_SkiaFont() {
if (m_Face)
@@ -167,23 +175,3 @@ uint32_t CFPF_SkiaFont::GetFontData(uint32_t dwTable,
return 0;
return pdfium::base::checked_cast<uint32_t>(ulSize);
}
-
-bool CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr* pFontMgr,
- const CFPF_SkiaPathFont* pFont,
- const ByteStringView& bsFamily,
- uint32_t dwStyle,
- uint8_t uCharset) {
- if (!pFontMgr || !pFont)
- return false;
-
- m_Face = pFontMgr->GetFontFace(pFont->path(), pFont->face_index());
- if (!m_Face)
- return false;
-
- m_dwStyle = dwStyle;
- m_uCharset = uCharset;
- m_pFontMgr = pFontMgr;
- m_pFont = pFont;
- m_dwRefCount = 1;
- return true;
-}