From 8a6348e6d2ef095358cfc7d29d2a50d684cc719e Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Thu, 12 Jul 2018 15:30:35 -0400 Subject: 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 Reviewed-by: Herb Derby Reviewed-by: Mike Klein --- src/gpu/text/GrTextContext.cpp | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'src/gpu/text/GrTextContext.cpp') 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 GrTextContext::createOp_TestingOnly(GrContext* context builder.drawText(skPaint, text, textLen, origin); sk_sp 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()); -- cgit v1.2.3