From 62b12feef7f869d631c4cb2541c5e7d69440bbb5 Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Tue, 14 Jan 2020 17:57:24 -0500 Subject: [PATCH] Handle color and translation outside of VertexRegenerator Change-Id: Ia06186328bd6fdc12f42355ec8fea9fc82ff51a6 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264425 Commit-Queue: Herb Derby Reviewed-by: Jim Van Verth --- src/atlastext/SkAtlasTextTarget.cpp | 10 +++++----- src/gpu/ops/GrAtlasTextOp.cpp | 6 ++++-- src/gpu/text/GrTextBlob.cpp | 6 ------ src/gpu/text/GrTextBlob.h | 1 - 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/atlastext/SkAtlasTextTarget.cpp b/src/atlastext/SkAtlasTextTarget.cpp index 46788e954b..45b3ae5064 100644 --- a/src/atlastext/SkAtlasTextTarget.cpp +++ b/src/atlastext/SkAtlasTextTarget.cpp @@ -234,12 +234,12 @@ void GrAtlasTextOp::executeForTextTarget(SkAtlasTextTarget* target) { } for (int i = 0; i < fGeoCount; ++i) { - // TODO4F: Preserve float colors - GrTextBlob::VertexRegenerator regenerator( - resourceProvider, fGeoData[i].fSubRunPtr, - fGeoData[i].fDrawMatrix, fGeoData[i].fDrawOrigin, - fGeoData[i].fColor.toBytes_RGBA(), &context, glyphCache, atlasManager); auto subRun = fGeoData[i].fSubRunPtr; + // TODO4F: Preserve float colors + subRun->updateVerticesColorIfNeeded(fGeoData[i].fColor.toBytes_RGBA()); + subRun->translateVerticesIfNeeded(fGeoData[i].fDrawMatrix, fGeoData[i].fDrawOrigin); + GrTextBlob::VertexRegenerator regenerator( + resourceProvider, fGeoData[i].fSubRunPtr, &context, glyphCache, atlasManager); int subRunEnd = subRun->fGlyphs.size(); for (int subRunIndex = 0; subRunIndex < subRunEnd;) { auto [ok, glyphsRegenerated] = regenerator.regenerate(subRunIndex, subRunEnd); diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp index c9d1f8026b..f790870d54 100644 --- a/src/gpu/ops/GrAtlasTextOp.cpp +++ b/src/gpu/ops/GrAtlasTextOp.cpp @@ -356,10 +356,12 @@ void GrAtlasTextOp::onPrepareDraws(Target* target) { auto subRun = args.fSubRunPtr; SkASSERT((int)subRun->vertexStride() == vertexStride); + subRun->updateVerticesColorIfNeeded(args.fColor.toBytes_RGBA()); + subRun->translateVerticesIfNeeded(args.fDrawMatrix, args.fDrawOrigin); + // TODO4F: Preserve float colors GrTextBlob::VertexRegenerator regenerator( - resourceProvider, args.fSubRunPtr, args.fDrawMatrix, args.fDrawOrigin, - args.fColor.toBytes_RGBA(), target->deferredUploadTarget(), glyphCache, + resourceProvider, args.fSubRunPtr, target->deferredUploadTarget(), glyphCache, atlasManager); // Where the subRun begins and ends relative to totalGlyphsRegened. diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp index 8baf97d6be..24d147c034 100644 --- a/src/gpu/text/GrTextBlob.cpp +++ b/src/gpu/text/GrTextBlob.cpp @@ -779,9 +779,6 @@ void GrTextBlob::processSourceMasks(const SkZip& drawab // -- GrTextBlob::VertexRegenerator ---------------------------------------------------------------- GrTextBlob::VertexRegenerator::VertexRegenerator(GrResourceProvider* resourceProvider, GrTextBlob::SubRun* subRun, - const SkMatrix& drawMatrix, - SkPoint drawOrigin, - GrColor color, GrDeferredUploadTarget* uploadTarget, GrStrikeCache* grStrikeCache, GrAtlasManager* fullAtlasManager) @@ -800,9 +797,6 @@ GrTextBlob::VertexRegenerator::VertexRegenerator(GrResourceProvider* resourcePro // updating our cache of the GrGlyph*s, we drop our ref on the old strike fActions.regenTextureCoordinates = fSubRun->strike()->isAbandoned(); fActions.regenStrike = fSubRun->strike()->isAbandoned(); - - fSubRun->updateVerticesColorIfNeeded(color); - fSubRun->translateVerticesIfNeeded(drawMatrix, drawOrigin); } std::tuple GrTextBlob::VertexRegenerator::updateTextureCoordinatesMaybeStrike( diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h index 8ce325edf5..af1841086b 100644 --- a/src/gpu/text/GrTextBlob.h +++ b/src/gpu/text/GrTextBlob.h @@ -297,7 +297,6 @@ public: * SkGlyphCache. */ VertexRegenerator(GrResourceProvider*, GrTextBlob::SubRun* subRun, - const SkMatrix& drawMatrix, SkPoint drawOrigin, GrColor color, GrDeferredUploadTarget*, GrStrikeCache*, GrAtlasManager*); // Return {success, number of glyphs regenerated}