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
|
// 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.
|
// pattern. So to avoid this, fill the glyph as a path instead.
|
||||||
#if XP_MACOSX
|
#if XP_MACOSX
|
||||||
RefPtr<Path> path =
|
RefPtr<Path> path = GetPathForGlyphs(aState, buffer);
|
||||||
aState.mScaledFont->GetPathForGlyphs(buffer, aState.mDrawTarget);
|
|
||||||
aState.mDrawTarget->Fill(path, *fillPattern, aState.mDrawOptions);
|
aState.mDrawTarget->Fill(path, *fillPattern, aState.mDrawOptions);
|
||||||
#else
|
#else
|
||||||
aState.mDrawTarget->FillGlyphs(aState.mScaledFont, buffer, *fillPattern,
|
aState.mDrawTarget->FillGlyphs(aState.mScaledFont, buffer, *fillPattern,
|
||||||
|
|
@ -1307,8 +1306,7 @@ struct PaintGlyph {
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
RefPtr<Path> path =
|
RefPtr<Path> path = GetPathForGlyphs(aState, buffer);
|
||||||
aState.mScaledFont->GetPathForGlyphs(buffer, aState.mDrawTarget);
|
|
||||||
aState.mDrawTarget->PushClip(path);
|
aState.mDrawTarget->PushClip(path);
|
||||||
bool ok = DispatchPaint(aState, aOffset + paintOffset, aBounds);
|
bool ok = DispatchPaint(aState, aOffset + paintOffset, aBounds);
|
||||||
aState.mDrawTarget->PopClip();
|
aState.mDrawTarget->PopClip();
|
||||||
|
|
@ -1319,10 +1317,19 @@ struct PaintGlyph {
|
||||||
MOZ_ASSERT(format == kFormat);
|
MOZ_ASSERT(format == kFormat);
|
||||||
Glyph g{uint16_t(glyphID), Point()};
|
Glyph g{uint16_t(glyphID), Point()};
|
||||||
GlyphBuffer buffer{&g, 1};
|
GlyphBuffer buffer{&g, 1};
|
||||||
RefPtr<Path> path =
|
RefPtr<Path> path = GetPathForGlyphs(aState, buffer);
|
||||||
aState.mScaledFont->GetPathForGlyphs(buffer, aState.mDrawTarget);
|
|
||||||
return path->GetFastBounds();
|
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 {
|
struct PaintColrGlyph {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue