diff options
Diffstat (limited to 'gfx/thebes/COLRFonts.cpp')
-rw-r--r-- | gfx/thebes/COLRFonts.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/gfx/thebes/COLRFonts.cpp b/gfx/thebes/COLRFonts.cpp index 6369bf191d..4a451f22d3 100644 --- a/gfx/thebes/COLRFonts.cpp +++ b/gfx/thebes/COLRFonts.cpp @@ -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 { |