зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1232822 (part 2) - Moz2Dify SetupGlyphExtents(). r=jfkthame.
The gfxContextMatrixAutoSaveRestore in SetupGlyphExtents() is now obviously not needed, and the rest is trivial.
This commit is contained in:
Родитель
2a8e0225ac
Коммит
52308b4cb3
|
@ -3190,16 +3190,12 @@ gfxFont::GetOrCreateGlyphExtents(int32_t aAppUnitsPerDevUnit) {
|
|||
}
|
||||
|
||||
void
|
||||
gfxFont::SetupGlyphExtents(gfxContext *aContext,
|
||||
uint32_t aGlyphID, bool aNeedTight,
|
||||
gfxGlyphExtents *aExtents)
|
||||
gfxFont::SetupGlyphExtents(DrawTarget* aDrawTarget, uint32_t aGlyphID,
|
||||
bool aNeedTight, gfxGlyphExtents *aExtents)
|
||||
{
|
||||
gfxContextMatrixAutoSaveRestore matrixRestore(aContext);
|
||||
aContext->SetMatrix(gfxMatrix());
|
||||
|
||||
gfxRect svgBounds;
|
||||
if (mFontEntry->TryGetSVGData(this) && mFontEntry->HasSVGGlyph(aGlyphID) &&
|
||||
mFontEntry->GetSVGGlyphExtents(aContext, aGlyphID, &svgBounds)) {
|
||||
mFontEntry->GetSVGGlyphExtents(aDrawTarget, aGlyphID, &svgBounds)) {
|
||||
gfxFloat d2a = aExtents->GetAppUnitsPerDevUnit();
|
||||
aExtents->SetTightGlyphExtents(aGlyphID,
|
||||
gfxRect(svgBounds.x * d2a,
|
||||
|
@ -3214,7 +3210,7 @@ gfxFont::SetupGlyphExtents(gfxContext *aContext,
|
|||
glyph.x = 0;
|
||||
glyph.y = 0;
|
||||
cairo_text_extents_t extents;
|
||||
cairo_glyph_extents(gfxContext::RefCairo(aContext->GetDrawTarget()),
|
||||
cairo_glyph_extents(gfxContext::RefCairo(aDrawTarget),
|
||||
&glyph, 1, &extents);
|
||||
|
||||
const Metrics& fontMetrics = GetMetrics(eHorizontal);
|
||||
|
|
|
@ -1655,8 +1655,8 @@ public:
|
|||
|
||||
gfxGlyphExtents *GetOrCreateGlyphExtents(int32_t aAppUnitsPerDevUnit);
|
||||
|
||||
// You need to call SetupCairoFont on the aCR just before calling this
|
||||
virtual void SetupGlyphExtents(gfxContext *aContext, uint32_t aGlyphID,
|
||||
// You need to call SetupCairoFont on aDrawTarget just before calling this.
|
||||
virtual void SetupGlyphExtents(DrawTarget* aDrawTarget, uint32_t aGlyphID,
|
||||
bool aNeedTight, gfxGlyphExtents *aExtents);
|
||||
|
||||
// This is called by the default Draw() implementation above.
|
||||
|
|
|
@ -333,7 +333,7 @@ gfxFontEntry::HasSVGGlyph(uint32_t aGlyphId)
|
|||
}
|
||||
|
||||
bool
|
||||
gfxFontEntry::GetSVGGlyphExtents(gfxContext *aContext, uint32_t aGlyphId,
|
||||
gfxFontEntry::GetSVGGlyphExtents(DrawTarget* aDrawTarget, uint32_t aGlyphId,
|
||||
gfxRect *aResult)
|
||||
{
|
||||
MOZ_ASSERT(mSVGInitialized,
|
||||
|
@ -342,8 +342,7 @@ gfxFontEntry::GetSVGGlyphExtents(gfxContext *aContext, uint32_t aGlyphId,
|
|||
"font has invalid unitsPerEm");
|
||||
|
||||
cairo_matrix_t fontMatrix;
|
||||
cairo_get_font_matrix(gfxContext::RefCairo(aContext->GetDrawTarget()),
|
||||
&fontMatrix);
|
||||
cairo_get_font_matrix(gfxContext::RefCairo(aDrawTarget), &fontMatrix);
|
||||
|
||||
gfxMatrix svgToAppSpace(fontMatrix.xx, fontMatrix.yx,
|
||||
fontMatrix.xy, fontMatrix.yy,
|
||||
|
|
|
@ -97,6 +97,8 @@ private:
|
|||
|
||||
class gfxFontEntry {
|
||||
public:
|
||||
typedef mozilla::gfx::DrawTarget DrawTarget;
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(gfxFontEntry)
|
||||
|
||||
explicit gfxFontEntry(const nsAString& aName, bool aIsStandardFace = false);
|
||||
|
@ -180,7 +182,7 @@ public:
|
|||
|
||||
bool TryGetSVGData(gfxFont* aFont);
|
||||
bool HasSVGGlyph(uint32_t aGlyphId);
|
||||
bool GetSVGGlyphExtents(gfxContext *aContext, uint32_t aGlyphId,
|
||||
bool GetSVGGlyphExtents(DrawTarget* aDrawTarget, uint32_t aGlyphId,
|
||||
gfxRect *aResult);
|
||||
bool RenderSVGGlyph(gfxContext *aContext, uint32_t aGlyphId, int aDrawMode,
|
||||
gfxTextContextPaint *aContextPaint);
|
||||
|
|
|
@ -49,7 +49,7 @@ gfxGlyphExtents::GetTightGlyphExtentsAppUnits(gfxFont *aFont,
|
|||
#ifdef DEBUG_TEXT_RUN_STORAGE_METRICS
|
||||
++gGlyphExtentsSetupLazyTight;
|
||||
#endif
|
||||
aFont->SetupGlyphExtents(aContext, aGlyphID, true, this);
|
||||
aFont->SetupGlyphExtents(aContext->GetDrawTarget(), aGlyphID, true, this);
|
||||
entry = mTightGlyphExtents.GetEntry(aGlyphID);
|
||||
}
|
||||
if (!entry) {
|
||||
|
|
|
@ -1420,7 +1420,7 @@ gfxTextRun::FetchGlyphExtents(gfxContext *aRefContext)
|
|||
#ifdef DEBUG_TEXT_RUN_STORAGE_METRICS
|
||||
++gGlyphExtentsSetupEagerSimple;
|
||||
#endif
|
||||
font->SetupGlyphExtents(aRefContext,
|
||||
font->SetupGlyphExtents(aRefContext->GetDrawTarget(),
|
||||
glyphIndex, false, extents);
|
||||
}
|
||||
}
|
||||
|
@ -1446,7 +1446,7 @@ gfxTextRun::FetchGlyphExtents(gfxContext *aRefContext)
|
|||
#ifdef DEBUG_TEXT_RUN_STORAGE_METRICS
|
||||
++gGlyphExtentsSetupEagerTight;
|
||||
#endif
|
||||
font->SetupGlyphExtents(aRefContext,
|
||||
font->SetupGlyphExtents(aRefContext->GetDrawTarget(),
|
||||
glyphIndex, true, extents);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче