aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/text/GrTextContext.cpp
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-07-28 18:07:54 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-31 13:52:20 +0000
commit74c6ed3d1f179209ec90025532310d9c8151999f (patch)
tree2d20cc433c2136b8a1832698e9c14118615696dc /src/gpu/text/GrTextContext.cpp
parent0bf5408286ea3dacb197c220e1033dea3eeef2a8 (diff)
Move one leaf loop from GPU to glyph drawer
Encapsulate the bitmap inner loop of regenerate in the SkGlyphRunListDrawer. This changed required placing an SkGlyphRunListDrawer in the two TextTargets. Change-Id: I7ef7a2d0074fe898fce4da82d26ea1f47e1f7a98 Reviewed-on: https://skia-review.googlesource.com/144302 Reviewed-by: Jim Van Verth <jvanverth@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Herb Derby <herb@google.com>
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,