@@ -329,7 +329,7 @@ void SkGlyphRunListPainter::processARGBFallback(
329329template <typename PerEmptyT, typename PerPathT>
330330void SkGlyphRunListPainter::drawGlyphRunAsPathWithARGBFallback (
331331 SkGlyphCacheInterface* pathCache, const SkGlyphRun& glyphRun,
332- SkPoint origin, const SkPaint& paint , const SkMatrix& viewMatrix, SkScalar textScale,
332+ SkPoint origin, const SkPaint& runPaint , const SkMatrix& viewMatrix, SkScalar textScale,
333333 PerEmptyT&& perEmpty, PerPathT&& perPath, ARGBFallback&& argbFallback) {
334334 fARGBGlyphsIDs .clear ();
335335 fARGBPositions .clear ();
@@ -356,10 +356,10 @@ void SkGlyphRunListPainter::drawGlyphRunAsPathWithARGBFallback(
356356 }
357357
358358 if (!fARGBGlyphsIDs .empty ()) {
359- SkPaint runPaint{paint };
360- glyphRun.font ().LEGACY_applyToPaint (&runPaint );
359+ SkPaint fallbackPaint{runPaint };
360+ glyphRun.font ().LEGACY_applyToPaint (&fallbackPaint );
361361 this ->processARGBFallback (
362- maxFallbackDimension, runPaint , viewMatrix, textScale,
362+ maxFallbackDimension, fallbackPaint , viewMatrix, textScale,
363363 std::move (argbFallback));
364364
365365 }
@@ -701,31 +701,33 @@ void GrTextBlob::generateFromGlyphRunList(GrGlyphCache* glyphCache,
701701 };
702702
703703 SkPoint origin = glyphRunList.origin ();
704- this -> initReusableBlob (
705- glyphRunList. paint () .computeLuminanceColor (), viewMatrix, origin.x (), origin.y ());
704+ const SkPaint& runPaint = glyphRunList. paint ();
705+ this -> initReusableBlob (runPaint .computeLuminanceColor (), viewMatrix, origin.x (), origin.y ());
706706
707707 for (const auto & glyphRun : glyphRunList) {
708- SkPaint runPaint {glyphRunList. paint ()} ;
709- glyphRun. font (). LEGACY_applyToPaint (&runPaint);
708+ const SkFont& runFont = glyphRun. font () ;
709+
710710 Run* run = this ->pushBackRun ();
711711
712- run->setRunFontAntiAlias (runPaint. isAntiAlias ());
712+ run->setRunFontAntiAlias (runFont. hasSomeAntiAliasing ());
713713
714- if (GrTextContext::CanDrawAsDistanceFields (runPaint,
715- SkFont::LEGACY_ExtractFromPaint (runPaint), viewMatrix, props,
714+ if (GrTextContext::CanDrawAsDistanceFields (runPaint, runFont, viewMatrix, props,
716715 shaderCaps.supportsDistanceFieldText (), options)) {
717716 bool hasWCoord = viewMatrix.hasPerspective ()
718717 || options.fDistanceFieldVerticesAlwaysHaveW ;
719718
720719 // Setup distance field runPaint and text ratio
721720 SkScalar textScale;
722721 SkPaint distanceFieldPaint{runPaint};
722+ runFont.LEGACY_applyToPaint (&distanceFieldPaint);
723723 SkScalerContextFlags flags;
724724 GrTextContext::InitDistanceFieldPaint (this , &distanceFieldPaint, viewMatrix,
725725 options, &textScale, &flags);
726726 this ->setHasDistanceField ();
727- run->setSubRunHasDistanceFields (runPaint.isLCDRenderText (),
728- runPaint.isAntiAlias (), hasWCoord);
727+ run->setSubRunHasDistanceFields (
728+ runFont.getEdging () == SkFont::Edging::kSubpixelAntiAlias ,
729+ runFont.hasSomeAntiAliasing (),
730+ hasWCoord);
729731
730732 {
731733 auto cache = run->setupCache (distanceFieldPaint, props, flags, SkMatrix::I ());
@@ -759,23 +761,24 @@ void GrTextBlob::generateFromGlyphRunList(GrGlyphCache* glyphCache,
759761 std::move (perEmpty), std::move (perSDF), std::move (perPath),
760762 std::move (argbFallback));
761763 }
762- } else if ( SkGlyphRunListPainter::ShouldDrawAsPath (
763- glyphRunList. paint (), glyphRun. font () , viewMatrix)) {
764+
765+ } else if ( SkGlyphRunListPainter::ShouldDrawAsPath (runPaint, runFont , viewMatrix)) {
764766 // The glyphs are big, so use paths to draw them.
765767
766768 // Ensure the blob is set for bitmaptext
767769 this ->setHasBitmap ();
768770
769771 // setup our std runPaint, in hopes of getting hits in the cache
770- SkPaint pathPaint ( runPaint) ;
771-
772- auto perEmpty = []( const SkGlyph&, SkPoint) {} ;
772+ SkPaint pathPaint{ runPaint} ;
773+ SkFont pathFont{runFont};
774+ SkScalar textScale = pathFont. setupForAsPaths (&pathPaint) ;
773775
774- SkScalar textScale = pathPaint.setupForAsPaths ();
775776 auto pathCache = SkStrikeCache::FindOrCreateStrikeExclusive (
776- SkFont::LEGACY_ExtractFromPaint (pathPaint) , pathPaint, props,
777+ pathFont , pathPaint, props,
777778 scalerContextFlags, SkMatrix::I ());
778779
780+ auto perEmpty = [](const SkGlyph&, SkPoint) {};
781+
779782 // Given a glyph that is not ARGB, draw it.
780783 auto perPath = [textScale, run]
781784 (const SkGlyph& glyph, SkPoint position) {
@@ -785,8 +788,7 @@ void GrTextBlob::generateFromGlyphRunList(GrGlyphCache* glyphCache,
785788 }
786789 };
787790
788- ARGBFallbackHelper argbFallback{this , run, props, scalerContextFlags,
789- glyphCache};
791+ ARGBFallbackHelper argbFallback{this , run, props, scalerContextFlags, glyphCache};
790792
791793 glyphPainter->drawGlyphRunAsPathWithARGBFallback (
792794 pathCache.get (), glyphRun, origin, runPaint, viewMatrix, textScale,
@@ -795,7 +797,9 @@ void GrTextBlob::generateFromGlyphRunList(GrGlyphCache* glyphCache,
795797 // Ensure the blob is set for bitmaptext
796798 this ->setHasBitmap ();
797799
798- auto cache = run->setupCache (runPaint, props, scalerContextFlags, viewMatrix);
800+ SkPaint cachePaint{runPaint};
801+ runFont.LEGACY_applyToPaint (&cachePaint);
802+ auto cache = run->setupCache (cachePaint, props, scalerContextFlags, viewMatrix);
799803
800804 sk_sp<GrTextStrike> currStrike = glyphCache->getStrike (cache.get ());
801805
0 commit comments