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>
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 04d92ae..a2ef40f 100644
--- a/src/gpu/text/GrTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -214,15 +214,17 @@
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 @@
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 @@
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());