b=489511; gfxFontCache will never hit on ft2 backend; r=karlt
authorTakuro Ashie <ashie@clear-code.com>
Wed, 22 Apr 2009 22:29:47 -0700
changeset 27656 fa066807790102a6c0921c1f36fa9b901f56866e
parent 27655 31881edd7c5dcb55a26549985b6f440a7943c84d
child 27657 88f76db49467b87ce93ed43653b5855d19e6bcc9
push id6674
push uservladimir@mozilla.com
push dateThu, 23 Apr 2009 05:30:22 +0000
treeherdermozilla-central@fa0668077901 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs489511
milestone1.9.2a1pre
b=489511; gfxFontCache will never hit on ft2 backend; r=karlt
gfx/thebes/src/gfxFT2Fonts.cpp
--- a/gfx/thebes/src/gfxFT2Fonts.cpp
+++ b/gfx/thebes/src/gfxFT2Fonts.cpp
@@ -883,24 +883,24 @@ gfxFT2Font::SetupCairoFont(gfxContext *a
 /**
  * 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)
 {
-    nsRefPtr<gfxFont> font = gfxFontCache::GetCache()->Lookup(aName, aStyle);
+    FontEntry *fe = gfxToolkitPlatform::GetPlatform()->FindFontEntry(aName, *aStyle);
+    if (!fe) {
+        printf("Failed to find font entry for %s\n", NS_ConvertUTF16toUTF8(aName).get());
+        return nsnull;
+    }
+
+    nsRefPtr<gfxFont> font = gfxFontCache::GetCache()->Lookup(fe->Name(), aStyle);
     if (!font) {
-        FontEntry *fe = gfxToolkitPlatform::GetPlatform()->FindFontEntry(aName, *aStyle);
-        if (!fe) {
-            printf("Failed to find font entry for %s\n", NS_ConvertUTF16toUTF8(aName).get());
-            return nsnull;
-        }
-
         font = new gfxFT2Font(fe, aStyle);
         if (!font)
             return nsnull;
         gfxFontCache::GetCache()->AddNew(font);
     }
     gfxFont *f = nsnull;
     font.swap(f);
     return static_cast<gfxFT2Font *>(f);