зеркало из https://github.com/mozilla/gecko-dev.git
Bug 906643. Part 4: Make each gfxFontEntry track its gfxFonts with SVG glyphs. r=jfkthame
--HG-- extra : rebase_source : cd2cbdc8f6722e71f523c3fbe19e515a0e44f043
This commit is contained in:
Родитель
9243c99ebb
Коммит
e75649fb2d
|
@ -248,7 +248,7 @@ gfxFontEntry::RenderSVGGlyph(gfxContext *aContext, uint32_t aGlyphId,
|
|||
}
|
||||
|
||||
bool
|
||||
gfxFontEntry::TryGetSVGData()
|
||||
gfxFontEntry::TryGetSVGData(gfxFont* aFont)
|
||||
{
|
||||
if (!gfxPlatform::GetPlatform()->OpenTypeSVGEnabled()) {
|
||||
return false;
|
||||
|
@ -269,9 +269,19 @@ gfxFontEntry::TryGetSVGData()
|
|||
mSVGGlyphs = new gfxSVGGlyphs(svgTable);
|
||||
}
|
||||
|
||||
if (!mFontsUsingSVGGlyphs.Contains(aFont)) {
|
||||
mFontsUsingSVGGlyphs.AppendElement(aFont);
|
||||
}
|
||||
|
||||
return !!mSVGGlyphs;
|
||||
}
|
||||
|
||||
void
|
||||
gfxFontEntry::NotifyFontDestroyed(gfxFont* aFont)
|
||||
{
|
||||
mFontsUsingSVGGlyphs.RemoveElement(aFont);
|
||||
}
|
||||
|
||||
/**
|
||||
* FontTableBlobData
|
||||
*
|
||||
|
@ -1713,6 +1723,8 @@ gfxFont::~gfxFont()
|
|||
for (i = 0; i < count; ++i) {
|
||||
delete mGlyphExtentsArray[i];
|
||||
}
|
||||
|
||||
mFontEntry->NotifyFontDestroyed(this);
|
||||
}
|
||||
|
||||
/*static*/
|
||||
|
@ -2295,7 +2307,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||
double direction = aTextRun->GetDirection();
|
||||
gfxMatrix globalMatrix = aContext->CurrentMatrix();
|
||||
|
||||
bool haveSVGGlyphs = GetFontEntry()->TryGetSVGData();
|
||||
bool haveSVGGlyphs = GetFontEntry()->TryGetSVGData(this);
|
||||
nsAutoPtr<gfxTextContextPaint> contextPaint;
|
||||
if (haveSVGGlyphs && !aContextPaint) {
|
||||
// If no pattern is specified for fill, use the current pattern
|
||||
|
@ -3389,7 +3401,7 @@ gfxFont::SetupGlyphExtents(gfxContext *aContext, uint32_t aGlyphID, bool aNeedTi
|
|||
aContext->IdentityMatrix();
|
||||
|
||||
gfxRect svgBounds;
|
||||
if (mFontEntry->TryGetSVGData() && mFontEntry->HasSVGGlyph(aGlyphID) &&
|
||||
if (mFontEntry->TryGetSVGData(this) && mFontEntry->HasSVGGlyph(aGlyphID) &&
|
||||
mFontEntry->GetSVGGlyphExtents(aContext, aGlyphID, &svgBounds)) {
|
||||
gfxFloat d2a = aExtents->GetAppUnitsPerDevUnit();
|
||||
aExtents->SetTightGlyphExtents(aGlyphID,
|
||||
|
|
|
@ -324,7 +324,7 @@ public:
|
|||
// can be safely dereferenced.
|
||||
virtual nsresult ReadCMAP();
|
||||
|
||||
bool TryGetSVGData();
|
||||
bool TryGetSVGData(gfxFont* aFont);
|
||||
bool HasSVGGlyph(uint32_t aGlyphId);
|
||||
bool GetSVGGlyphExtents(gfxContext *aContext, uint32_t aGlyphId,
|
||||
gfxRect *aResult);
|
||||
|
@ -414,6 +414,10 @@ public:
|
|||
// Caller must call gfxFontEntry::ReleaseGrFace when finished with it.
|
||||
gr_face* GetGrFace();
|
||||
virtual void ReleaseGrFace(gr_face* aFace);
|
||||
|
||||
// Called to notify that aFont is being destroyed. Needed when we're tracking
|
||||
// the fonts belonging to this font entry.
|
||||
void NotifyFontDestroyed(gfxFont* aFont);
|
||||
|
||||
// For memory reporting
|
||||
virtual void SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
|
@ -457,7 +461,8 @@ public:
|
|||
nsAutoArrayPtr<uint8_t> mUVSData;
|
||||
gfxUserFontData* mUserFontData;
|
||||
gfxSVGGlyphs *mSVGGlyphs;
|
||||
|
||||
// list of gfxFonts that are using SVG glyphs
|
||||
nsTArray<gfxFont*> mFontsUsingSVGGlyphs;
|
||||
nsTArray<gfxFontFeature> mFeatureSettings;
|
||||
uint32_t mLanguageOverride;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче