[Bug 539037] Qt bustage in gfxFontEntry. r=vlad. qt only
authorDoug Turner <dougt@dougt.org>
Mon, 11 Jan 2010 12:31:43 -0800
changeset 37051 b94cf8147ccd
parent 37050 6ca5aac8eabf
child 37052 5dca6c28cca5
push id11115
push userdougt@mozilla.com
push dateMon, 11 Jan 2010 20:32:27 +0000
treeherdermozilla-central@b94cf8147ccd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvlad
bugs539037
milestone1.9.3a1pre
[Bug 539037] Qt bustage in gfxFontEntry. r=vlad. qt only
gfx/thebes/public/gfxQtPlatform.h
gfx/thebes/src/gfxQtPlatform.cpp
--- a/gfx/thebes/public/gfxQtPlatform.h
+++ b/gfx/thebes/public/gfxQtPlatform.h
@@ -75,22 +75,28 @@ public:
 
     gfxFontGroup *CreateFontGroup(const nsAString &aFamilies,
                                   const gfxFontStyle *aStyle,
                                   gfxUserFontSet* aUserFontSet);
 
     FontFamily *FindFontFamily(const nsAString& aName);
     FontEntry *FindFontEntry(const nsAString& aFamilyName, const gfxFontStyle& aFontStyle);
     already_AddRefed<gfxFont> FindFontForChar(PRUint32 aCh, gfxFont *aFont);
-    PRBool GetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<FontEntry> > *aFontEntryList);
-    void SetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<FontEntry> >& aFontEntryList);
+    PRBool GetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<gfxFontEntry> > *aFontEntryList);
+    void SetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<gfxFontEntry> >& aFontEntryList);
+
+    void ClearPrefFonts() { mPrefFonts.Clear(); }
 
     FT_Library GetFTLibrary();
 
 protected:
     static gfxFontconfigUtils *sFontconfigUtils;
 
 private:
     virtual qcms_profile *GetPlatformCMSOutputProfile();
+
+    // TODO: unify this with mPrefFonts (NB: holds families, not fonts) in gfxPlatformFontList
+    nsDataHashtable<nsCStringHashKey, nsTArray<nsRefPtr<gfxFontEntry> > > mPrefFonts;
+
 };
 
 #endif /* GFX_PLATFORM_QT_H */
 
--- a/gfx/thebes/src/gfxQtPlatform.cpp
+++ b/gfx/thebes/src/gfxQtPlatform.cpp
@@ -78,16 +78,18 @@ static FontTable *gPlatformFonts = NULL;
 static FontTable *gPlatformFontAliases = NULL;
 static PrefFontTable *gPrefFonts = NULL;
 static gfxSparseBitSet *gCodepointsWithNoFonts = NULL;
 static FT_Library gPlatformFTLibrary = NULL;
 
 
 gfxQtPlatform::gfxQtPlatform()
 {
+    mPrefFonts.Init(50);
+
     if (!sFontconfigUtils)
         sFontconfigUtils = gfxFontconfigUtils::GetFontconfigUtils();
 
 
     FT_Init_FreeType(&gPlatformFTLibrary);
 
     gPlatformFonts = new FontTable();
     gPlatformFonts->Init(100);
@@ -148,17 +150,16 @@ gfxQtPlatform::GetFontList(const nsACStr
 }
 
 nsresult
 gfxQtPlatform::UpdateFontList()
 {
     FcPattern *pat = NULL;
     FcObjectSet *os = NULL;
     FcFontSet *fs = NULL;
-    PRInt32 result = -1;
 
     pat = FcPatternCreate();
     os = FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_INDEX, FC_WEIGHT, FC_SLANT, FC_WIDTH, NULL);
 
     fs = FcFontList(NULL, pat, os);
 
 
     for (int i = 0; i < fs->nfont; i++) {
@@ -412,18 +413,18 @@ gfxQtPlatform::FindFontForChar(PRUint32 
 
     // no match? add to set of non-matching codepoints
     gCodepointsWithNoFonts->set(aCh);
 
     return nsnull;
 }
 
 PRBool
-gfxQtPlatform::GetPrefFontEntries(const nsCString& aKey, nsTArray<nsRefPtr<FontEntry> > *aFontEntryList)
+gfxQtPlatform::GetPrefFontEntries(const nsCString& aKey, nsTArray<nsRefPtr<gfxFontEntry> > *array)
 {
-    return gPrefFonts->Get(aKey, aFontEntryList);
+    return mPrefFonts.Get(aKey, array);
 }
 
 void
-gfxQtPlatform::SetPrefFontEntries(const nsCString& aKey, nsTArray<nsRefPtr<FontEntry> >& aFontEntryList)
+gfxQtPlatform::SetPrefFontEntries(const nsCString& aKey, nsTArray<nsRefPtr<gfxFontEntry> >& array)
 {
-    gPrefFonts->Put(aKey, aFontEntryList);
+    mPrefFonts.Put(aKey, array);
 }