aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/text/GrTextContext.cpp
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-07-12 15:30:35 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-13 03:21:54 +0000
commit8a6348e6d2ef095358cfc7d29d2a50d684cc719e (patch)
tree0554d2811a9550190ebca43f847b1c48e987f8cc /src/gpu/text/GrTextContext.cpp
parent1c5fd18927d5a128a12d7d5fe27f08d898be1e5b (diff)
Introduce text blob processing but don't wire it up
Have all the old code paths start using lists in preparation for introducing text blobs. Change-Id: I65cc02ee3da63bc3c9492db78a08b0eee3b1f931 Reviewed-on: https://skia-review.googlesource.com/141081 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'src/gpu/text/GrTextContext.cpp')
-rw-r--r--src/gpu/text/GrTextContext.cpp37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 04d92aef39..a2ef40f16d 100644
--- a/src/gpu/text/GrTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -214,15 +214,17 @@ void GrTextContext::regenerateTextBlob(GrTextBlob* cacheBlob,
builder.drawText(runPaint.skPaint(),
(const char*) it.glyphs(), textLen, origin);
- auto glyphRun = builder.useGlyphRun();
-
- glyphRun->temporaryShuntToCallback(
+ auto glyphRunList = builder.useGlyphRunList();
+ if (!glyphRunList->empty()) {
+ auto glyphRun = (*glyphRunList)[0];
+ glyphRun.temporaryShuntToCallback(
[&](size_t runSize, const char* glyphIDs, const SkScalar* pos) {
this->drawDFPosText(
- cacheBlob, run, glyphCache, props, runPaint, scalerContextFlags,
- viewMatrix, glyphIDs, 2 * runSize, pos, 2,
- SkPoint::Make(0,0));
+ cacheBlob, run, glyphCache, props, runPaint,
+ scalerContextFlags, viewMatrix, glyphIDs, 2 * runSize,
+ pos, 2, SkPoint::Make(0, 0));
});
+ }
break;
}
@@ -249,15 +251,18 @@ void GrTextContext::regenerateTextBlob(GrTextBlob* cacheBlob,
builder.drawText(runPaint.skPaint(),
(const char*) it.glyphs(), textLen, origin);
- auto glyphRun = builder.useGlyphRun();
+ auto glyphRunList = builder.useGlyphRunList();
+ if (!glyphRunList->empty()) {
+ auto glyphRun = (*glyphRunList)[0];
- glyphRun->temporaryShuntToCallback(
+ glyphRun.temporaryShuntToCallback(
[&](size_t runSize, const char* glyphIDs, const SkScalar* pos) {
this->DrawBmpPosText(
- cacheBlob, run, glyphCache, props, runPaint, scalerContextFlags,
- viewMatrix, glyphIDs, 2 * runSize,
+ cacheBlob, run, glyphCache, props, runPaint,
+ scalerContextFlags, viewMatrix, glyphIDs, 2 * runSize,
pos, 2, SkPoint::Make(0, 0));
});
+ }
break;
}
case SkTextBlob::kHorizontal_Positioning:
@@ -783,16 +788,20 @@ std::unique_ptr<GrDrawOp> GrTextContext::createOp_TestingOnly(GrContext* context
builder.drawText(skPaint, text, textLen, origin);
sk_sp<GrTextBlob> blob;
- auto glyphRun = builder.useGlyphRun();
- // Use the text and textLen below, because we don't want to mess with the paint.
- glyphRun->temporaryShuntToCallback(
+ auto glyphRunList = builder.useGlyphRunList();
+ if (!glyphRunList->empty()) {
+ auto glyphRun = (*glyphRunList)[0];
+ // Use the text and textLen below, because we don't want to mess with the paint.
+ glyphRun.temporaryShuntToCallback(
[&](size_t runSize, const char* glyphIDs, const SkScalar* pos) {
blob = textContext->makeDrawPosTextBlob(
context->contextPriv().getTextBlobCache(), glyphCache,
*context->contextPriv().caps()->shaderCaps(), utilsPaint,
- GrTextContext::kTextBlobOpScalerContextFlags, viewMatrix, surfaceProps, text,
+ GrTextContext::kTextBlobOpScalerContextFlags, viewMatrix, surfaceProps,
+ text,
textLen, pos, 2, origin);
});
+ }
return blob->test_makeOp(textLen, 0, 0, viewMatrix, x, y, utilsPaint, surfaceProps,
textContext->dfAdjustTable(), rtc->textTarget());