Bug 1100221 - eliminate unused GetOrMakeFont for Android. r=m_kato
authorJohn Daggett <jdaggett@mozilla.com>
Mon, 17 Nov 2014 16:48:51 +0900
changeset 215968 c386915cdeda12e86236d529829052a21a444851
parent 215967 d6cef8f84cb52ad5ff9ba873f65b4bf95162478a
child 215969 d08b388c879a0b003129293f64ef2c67769b44ab
push id51900
push userjdaggett@mozilla.com
push dateMon, 17 Nov 2014 07:50:34 +0000
treeherdermozilla-inbound@c386915cdeda [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1100221
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1100221 - eliminate unused GetOrMakeFont for Android. r=m_kato
gfx/thebes/gfxFT2Fonts.cpp
gfx/thebes/gfxFT2Fonts.h
--- a/gfx/thebes/gfxFT2Fonts.cpp
+++ b/gfx/thebes/gfxFT2Fonts.cpp
@@ -169,62 +169,16 @@ gfxFT2Font::gfxFT2Font(cairo_scaled_font
     NS_ASSERTION(mFontEntry, "Unable to find font entry for font.  Something is whack.");
     mApplySyntheticBold = aNeedsBold;
 }
 
 gfxFT2Font::~gfxFT2Font()
 {
 }
 
-/**
- * Look up the font in the gfxFont cache. If we don't find it, create one.
- * In either case, add a ref, append it to the aFonts array, and return it ---
- * except for OOM in which case we do nothing and return null.
- */
-already_AddRefed<gfxFT2Font>
-gfxFT2Font::GetOrMakeFont(const nsAString& aName, const gfxFontStyle *aStyle,
-                          bool aNeedsBold)
-{
-#ifdef ANDROID
-    FT2FontEntry *fe = static_cast<FT2FontEntry*>
-        (gfxPlatformFontList::PlatformFontList()->
-            FindFontForFamily(aName, aStyle, aNeedsBold));
-#else
-    FT2FontEntry *fe = static_cast<FT2FontEntry*>
-        (gfxToolkitPlatform::GetPlatform()->FindFontEntry(aName, *aStyle));
-#endif
-    if (!fe) {
-        NS_WARNING("Failed to find font entry for font!");
-        return nullptr;
-    }
-
-    nsRefPtr<gfxFT2Font> font = GetOrMakeFont(fe, aStyle, aNeedsBold);
-    return font.forget();
-}
-
-already_AddRefed<gfxFT2Font>
-gfxFT2Font::GetOrMakeFont(FT2FontEntry *aFontEntry, const gfxFontStyle *aStyle,
-                          bool aNeedsBold)
-{
-    nsRefPtr<gfxFont> font = gfxFontCache::GetCache()->Lookup(aFontEntry, aStyle);
-    if (!font) {
-        cairo_scaled_font_t *scaledFont = aFontEntry->CreateScaledFont(aStyle);
-        if (!scaledFont) {
-            return nullptr;
-        }
-        font = new gfxFT2Font(scaledFont, aFontEntry, aStyle, aNeedsBold);
-        cairo_scaled_font_destroy(scaledFont);
-        if (!font) {
-            return nullptr;
-        }
-        gfxFontCache::GetCache()->AddNew(font);
-    }
-    return font.forget().downcast<gfxFT2Font>();
-}
-
 void
 gfxFT2Font::FillGlyphDataForChar(uint32_t ch, CachedGlyphData *gd)
 {
     gfxFT2LockedFace faceLock(this);
     FT_Face face = faceLock.get();
 
     if (!face->charmap || face->charmap->encoding != FT_ENCODING_UNICODE) {
         FT_Select_Charmap(face, FT_ENCODING_UNICODE);
--- a/gfx/thebes/gfxFT2Fonts.h
+++ b/gfx/thebes/gfxFT2Fonts.h
@@ -22,24 +22,16 @@ public: // new functions
     gfxFT2Font(cairo_scaled_font_t *aCairoFont,
                FT2FontEntry *aFontEntry,
                const gfxFontStyle *aFontStyle,
                bool aNeedsBold);
     virtual ~gfxFT2Font ();
 
     FT2FontEntry *GetFontEntry();
 
-    static already_AddRefed<gfxFT2Font>
-    GetOrMakeFont(const nsAString& aName, const gfxFontStyle *aStyle,
-                  bool aNeedsBold = false);
-
-    static already_AddRefed<gfxFT2Font>
-    GetOrMakeFont(FT2FontEntry *aFontEntry, const gfxFontStyle *aStyle,
-                  bool aNeedsBold = false);
-
     struct CachedGlyphData {
         CachedGlyphData()
             : glyphIndex(0xffffffffU) { }
 
         CachedGlyphData(uint32_t gid)
             : glyphIndex(gid) { }
 
         uint32_t glyphIndex;