forked from mirrors/gecko-dev
Bug 1891630 - Avoid calling GetPathForGlyphs with a TextDrawTarget. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D207619
This commit is contained in:
parent
d999dfa37e
commit
97b85d8b7d
1 changed files with 13 additions and 6 deletions
|
|
@ -1298,8 +1298,7 @@ struct PaintGlyph {
|
|||
// Core Text's own color font support may step in and ignore the
|
||||
// pattern. So to avoid this, fill the glyph as a path instead.
|
||||
#if XP_MACOSX
|
||||
RefPtr<Path> path =
|
||||
aState.mScaledFont->GetPathForGlyphs(buffer, aState.mDrawTarget);
|
||||
RefPtr<Path> path = GetPathForGlyphs(aState, buffer);
|
||||
aState.mDrawTarget->Fill(path, *fillPattern, aState.mDrawOptions);
|
||||
#else
|
||||
aState.mDrawTarget->FillGlyphs(aState.mScaledFont, buffer, *fillPattern,
|
||||
|
|
@ -1307,8 +1306,7 @@ struct PaintGlyph {
|
|||
#endif
|
||||
return true;
|
||||
}
|
||||
RefPtr<Path> path =
|
||||
aState.mScaledFont->GetPathForGlyphs(buffer, aState.mDrawTarget);
|
||||
RefPtr<Path> path = GetPathForGlyphs(aState, buffer);
|
||||
aState.mDrawTarget->PushClip(path);
|
||||
bool ok = DispatchPaint(aState, aOffset + paintOffset, aBounds);
|
||||
aState.mDrawTarget->PopClip();
|
||||
|
|
@ -1319,10 +1317,19 @@ struct PaintGlyph {
|
|||
MOZ_ASSERT(format == kFormat);
|
||||
Glyph g{uint16_t(glyphID), Point()};
|
||||
GlyphBuffer buffer{&g, 1};
|
||||
RefPtr<Path> path =
|
||||
aState.mScaledFont->GetPathForGlyphs(buffer, aState.mDrawTarget);
|
||||
RefPtr<Path> path = GetPathForGlyphs(aState, buffer);
|
||||
return path->GetFastBounds();
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<Path> GetPathForGlyphs(const PaintState& aState,
|
||||
const GlyphBuffer& buffer) const {
|
||||
if (aState.mDrawTarget->GetBackendType() == BackendType::WEBRENDER_TEXT) {
|
||||
RefPtr dt = gfxPlatform::ThreadLocalScreenReferenceDrawTarget();
|
||||
return aState.mScaledFont->GetPathForGlyphs(buffer, dt);
|
||||
}
|
||||
return aState.mScaledFont->GetPathForGlyphs(buffer, aState.mDrawTarget);
|
||||
}
|
||||
};
|
||||
|
||||
struct PaintColrGlyph {
|
||||
|
|
|
|||
Loading…
Reference in a new issue