Handle color and translation outside of VertexRegenerator

Change-Id: Ia06186328bd6fdc12f42355ec8fea9fc82ff51a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264425
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Herb Derby 2020-01-14 17:57:24 -05:00 committed by Skia Commit-Bot
parent c4b8eefe56
commit 62b12feef7
4 changed files with 9 additions and 14 deletions

View File

@ -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);

View File

@ -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.

View File

@ -779,9 +779,6 @@ void GrTextBlob::processSourceMasks(const SkZip<SkGlyphVariant, SkPoint>& 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<bool, int> GrTextBlob::VertexRegenerator::updateTextureCoordinatesMaybeStrike(

View File

@ -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}