aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/text/GrTextContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/text/GrTextContext.cpp')
-rw-r--r--src/gpu/text/GrTextContext.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 7b15abc666..6017742707 100644
--- a/src/gpu/text/GrTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -92,7 +92,8 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
SkScalerContextFlags scalerContextFlags,
const SkMatrix& viewMatrix,
const SkSurfaceProps& props,
- const SkGlyphRunList& glyphRunList) const {
+ const SkGlyphRunList& glyphRunList,
+ SkGlyphRunListDrawer* glyphDrawer) {
SkPoint origin = glyphRunList.origin();
cacheBlob->initReusableBlob(paint.luminanceColor(), viewMatrix, origin.x(), origin.y());
@@ -193,19 +194,17 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
sk_sp<GrTextStrike> currStrike;
auto cache = cacheBlob->setupCache(
runIndex, props, scalerContextFlags, runPaint, &viewMatrix);
- SkFindAndPlaceGlyph::ProcessPosText(
- SkPaint::kGlyphID_TextEncoding,
- (const char*) glyphRun.shuntGlyphsIDs().data(),
- glyphRun.shuntGlyphsIDs().size() * sizeof(SkGlyphID),
- origin, viewMatrix, (const SkScalar*) glyphRun.positions().data(), 2, cache.get(),
- [&](const SkGlyph& glyph, SkPoint position, SkPoint rounding) {
- position += rounding;
- BmpAppendGlyph(cacheBlob, runIndex, glyphCache, &currStrike, glyph,
- SkScalarFloorToScalar(position.fX),
- SkScalarFloorToScalar(position.fY),
- runPaint.filteredPremulColor(), cache.get(), SK_Scalar1, false);
- }
- );
+
+ auto drawOneGlyph =
+ [cacheBlob, runIndex, glyphCache, &currStrike, runPaint, cache{cache.get()}]
+ (const SkMask& mask, const SkGlyph& glyph, SkPoint position) {
+ BmpAppendGlyph(cacheBlob, runIndex, glyphCache, &currStrike, glyph,
+ SkScalarFloorToScalar(position.fX),
+ SkScalarFloorToScalar(position.fY),
+ runPaint.filteredPremulColor(), cache, SK_Scalar1, false);
+ };
+
+ glyphDrawer->drawUsingMasks(cache.get(), glyphRun, origin, viewMatrix, drawOneGlyph);
}
runIndex += 1;
}
@@ -270,7 +269,8 @@ void GrTextContext::drawGlyphRunList(
cacheBlob = textBlobCache->makeCachedBlob(glyphRunList, key, blurRec, skPaint);
this->regenerateGlyphRunList(cacheBlob.get(), glyphCache,
*context->contextPriv().caps()->shaderCaps(), paint,
- scalerContextFlags, viewMatrix, props, glyphRunList);
+ scalerContextFlags, viewMatrix, props, glyphRunList,
+ target->glyphDrawer());
} else {
textBlobCache->makeMRU(cacheBlob.get());
@@ -281,7 +281,8 @@ void GrTextContext::drawGlyphRunList(
sanityBlob->setupKey(key, blurRec, skPaint);
this->regenerateGlyphRunList(
sanityBlob.get(), glyphCache, *context->contextPriv().caps()->shaderCaps(),
- paint, scalerContextFlags, viewMatrix, props, glyphRunList);
+ paint, scalerContextFlags, viewMatrix, props, glyphRunList,
+ target->glyphDrawer());
GrTextBlob::AssertEqual(*sanityBlob, *cacheBlob);
}
}
@@ -293,7 +294,8 @@ void GrTextContext::drawGlyphRunList(
}
this->regenerateGlyphRunList(cacheBlob.get(), glyphCache,
*context->contextPriv().caps()->shaderCaps(), paint,
- scalerContextFlags, viewMatrix, props, glyphRunList);
+ scalerContextFlags, viewMatrix, props, glyphRunList,
+ target->glyphDrawer());
}
cacheBlob->flush(target, props, fDistanceAdjustTable.get(), paint,