aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/text
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-07-30 10:10:40 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-31 20:51:18 +0000
commit0ab5ce151c4507966c135ab3986cf2b28b36d6c6 (patch)
tree42fac4dd57f2027f027be03f43343059f27b30af /src/gpu/text
parenta83bb57bfe2be07a7fb60cd01417e8c69e77e967 (diff)
Move path leaf loop to drawer
This CL makes GPU and Raster use the same path drawing interface. When I get the main body of regenerate over into the glyph run system, I I can refactor a lot of annoyingly similar code away. Change-Id: I6bd2e6119570062695d6943565749d85555b03fa Reviewed-on: https://skia-review.googlesource.com/144350 Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'src/gpu/text')
-rw-r--r--src/gpu/text/GrTextContext.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 6017742707..966f3c2f7e 100644
--- a/src/gpu/text/GrTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -169,21 +169,20 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
auto cache = SkStrikeCache::FindOrCreateStrikeExclusive(
pathPaint, &props, SkScalerContextFlags::kFakeGammaAndBoostContrast, nullptr);
- const SkPoint* positionCursor = glyphRun.positions().data();
- for (auto glyphID : glyphRun.shuntGlyphsIDs()) {
- const SkGlyph& glyph = cache->getGlyphIDMetrics(glyphID);
- SkPoint loc = origin + *positionCursor++;
- if (glyph.fWidth > 0) {
- if (glyph.fMaskFormat == SkMask::kARGB32_Format) {
- fallbackTextHelper.appendText(glyph, glyphID, loc);
- } else {
- const SkPath* path = cache->findPath(glyph);
- if (path != nullptr) {
- cacheBlob->appendPathGlyph(runIndex, *path, loc.fX, loc.fY, matrixScale, false);
- }
+ auto drawOnePath =
+ [&fallbackTextHelper, matrixScale, runIndex, cacheBlob]
+ (const SkPath* path, const SkGlyph& glyph, SkPoint position) {
+ if (glyph.fMaskFormat == SkMask::kARGB32_Format) {
+ fallbackTextHelper.appendText(glyph, glyph.getGlyphID(), position);
+ } else {
+ if (path != nullptr) {
+ cacheBlob->appendPathGlyph(
+ runIndex, *path, position.fX, position.fY, matrixScale, false);
}
}
- }
+ };
+
+ glyphDrawer->drawUsingPaths(glyphRun, origin, cache.get(), drawOnePath);
fallbackTextHelper.drawText(
cacheBlob, runIndex, glyphCache, props, runPaint, scalerContextFlags);