mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 13:57:32 +00:00
b=356235, implement textrun cache (landing #2), r+sr=roc,sr=stuart
This commit is contained in:
parent
c13ee71991
commit
1a223fbafb
@ -23,6 +23,7 @@ EXPORTS = gfxASurface.h \
|
||||
gfxRect.h \
|
||||
gfxRegion.h \
|
||||
gfxTypes.h \
|
||||
gfxTextRunCache.h \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_ENABLE_GLITZ
|
||||
|
@ -111,6 +111,18 @@ struct THEBES_API gfxFontStyle {
|
||||
|
||||
void ComputeWeightAndOffset(PRInt8 *outBaseWeight,
|
||||
PRInt8 *outOffset) const;
|
||||
|
||||
PRBool Equals(const gfxFontStyle& other) const {
|
||||
return (size == other.size) &&
|
||||
(style == other.style) &&
|
||||
(systemFont == other.systemFont) &&
|
||||
(variant == other.variant) &&
|
||||
(familyNameQuirks == other.familyNameQuirks) &&
|
||||
(weight == other.weight) &&
|
||||
(decorations == other.decorations) &&
|
||||
(langGroup.Equals(other.langGroup)) &&
|
||||
(sizeAdjust == other.sizeAdjust);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -160,6 +172,8 @@ protected:
|
||||
|
||||
|
||||
class THEBES_API gfxFontGroup {
|
||||
THEBES_INLINE_DECL_REFCOUNTING(gfxFontGroup)
|
||||
|
||||
public:
|
||||
gfxFontGroup(const nsAString& aFamilies, const gfxFontStyle *aStyle);
|
||||
|
||||
@ -174,6 +188,11 @@ public:
|
||||
return mFonts.Length();
|
||||
}
|
||||
|
||||
PRBool Equals(const gfxFontGroup& other) const {
|
||||
return mFamilies.Equals(other.mFamilies) &&
|
||||
mStyle.Equals(other.mStyle);
|
||||
}
|
||||
|
||||
const gfxFontStyle *GetStyle() const { return &mStyle; }
|
||||
|
||||
/* unicode method */
|
||||
@ -197,6 +216,8 @@ public:
|
||||
/* this will call back fc with the a generic font based on the style's langgroup */
|
||||
void FindGenericFontFromStyle(FontCreationCallback fc, void *closure);
|
||||
|
||||
const nsString& GetFamilies() { return mFamilies; }
|
||||
|
||||
protected:
|
||||
nsString mFamilies;
|
||||
gfxFontStyle mStyle;
|
||||
|
@ -90,6 +90,10 @@ protected:
|
||||
mString = &mRealString;
|
||||
}
|
||||
|
||||
const GenericString& GetString() {
|
||||
return mRealString;
|
||||
}
|
||||
|
||||
nsRefPtr<gfxFontGroup> mFontGroup;
|
||||
RealString mRealString;
|
||||
const GenericString* mString;
|
||||
|
@ -27,6 +27,7 @@ CPPSRCS = \
|
||||
gfxImageSurface.cpp \
|
||||
gfxFont.cpp \
|
||||
gfxPlatform.cpp \
|
||||
gfxTextRunCache.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_TREE_CAIRO
|
||||
|
@ -80,9 +80,9 @@ gfxTextRunCache::GetOrMakeTextRun (gfxFontGroup *aFontGroup, const nsAString& aS
|
||||
entry->Used();
|
||||
tr = entry->textRun.get();
|
||||
} else {
|
||||
tr = aFontGroup->MakeTextRun(aString);
|
||||
entry = new TextRunEntry(tr);
|
||||
key.Realize();
|
||||
tr = aFontGroup->MakeTextRun(key.GetString());
|
||||
entry = new TextRunEntry(tr);
|
||||
mHashTableUTF16.Put(key, entry);
|
||||
}
|
||||
|
||||
@ -106,9 +106,9 @@ gfxTextRunCache::GetOrMakeTextRun (gfxFontGroup *aFontGroup, const nsACString& a
|
||||
entry->Used();
|
||||
tr = entry->textRun.get();
|
||||
} else {
|
||||
tr = aFontGroup->MakeTextRun(aString);
|
||||
entry = new TextRunEntry(tr);
|
||||
key.Realize();
|
||||
tr = aFontGroup->MakeTextRun(key.GetString());
|
||||
entry = new TextRunEntry(tr);
|
||||
mHashTableASCII.Put(key, entry);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user