regenTextureCoordinates is always true when calling doRegen
* Rename doRegen -> updateTextureCoordinatesMaybeStrike * Collapse all regenTextureCoordinates if statements Change-Id: I0afba60c657f9b805b07247673d9f24c265b9a0b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262937 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
d7b630abe0
commit
586f8d04d4
@ -872,10 +872,9 @@ GrTextBlob::VertexRegenerator::VertexRegenerator(GrResourceProvider* resourcePro
|
||||
fSubRun->translateVerticesIfNeeded(drawMatrix, drawOrigin);
|
||||
}
|
||||
|
||||
bool GrTextBlob::VertexRegenerator::doRegen(GrTextBlob::VertexRegenerator::Result* result,
|
||||
int maxGlyphs) {
|
||||
SkASSERT(!fActions.regenStrike || fActions.regenTextureCoordinates);
|
||||
if (fActions.regenTextureCoordinates) {
|
||||
bool GrTextBlob::VertexRegenerator::updateTextureCoordinatesMaybeStrike(
|
||||
Result* result, int maxGlyphs) {
|
||||
SkASSERT(fActions.regenTextureCoordinates);
|
||||
fSubRun->resetBulkUseToken();
|
||||
|
||||
const SkStrikeSpec& strikeSpec = fSubRun->strikeSpec();
|
||||
@ -902,7 +901,6 @@ bool GrTextBlob::VertexRegenerator::doRegen(GrTextBlob::VertexRegenerator::Resul
|
||||
|
||||
fSubRun->setStrike(newStrike);
|
||||
}
|
||||
}
|
||||
|
||||
int glyphLimit = std::min((int)fSubRun->fGlyphs.size(), fCurrGlyph + maxGlyphs);
|
||||
|
||||
@ -914,7 +912,6 @@ bool GrTextBlob::VertexRegenerator::doRegen(GrTextBlob::VertexRegenerator::Resul
|
||||
|
||||
auto code = GrDrawOpAtlas::ErrorCode::kSucceeded;
|
||||
int startingGlyph = fCurrGlyph;
|
||||
if (fActions.regenTextureCoordinates) {
|
||||
GrTextStrike* grStrike = fSubRun->strike();
|
||||
for (; fCurrGlyph < glyphLimit; fCurrGlyph++) {
|
||||
GrGlyph* glyph = fSubRun->fGlyphs[fCurrGlyph];
|
||||
@ -933,9 +930,6 @@ bool GrTextBlob::VertexRegenerator::doRegen(GrTextBlob::VertexRegenerator::Resul
|
||||
fSubRun->bulkUseToken(), glyph, tokenTracker->nextDrawToken());
|
||||
fSubRun->updateTexCoord(fCurrGlyph);
|
||||
}
|
||||
} else {
|
||||
fCurrGlyph = glyphLimit;
|
||||
}
|
||||
|
||||
result->fFinished = fCurrGlyph == (int)fSubRun->fGlyphs.size();
|
||||
result->fGlyphsRegenerated += fCurrGlyph - startingGlyph;
|
||||
@ -950,20 +944,12 @@ bool GrTextBlob::VertexRegenerator::doRegen(GrTextBlob::VertexRegenerator::Resul
|
||||
return true;
|
||||
}
|
||||
case GrDrawOpAtlas::ErrorCode::kSucceeded: {
|
||||
if (fActions.regenTextureCoordinates) {
|
||||
// if brokenRun, then the previous call to doRegen exited with kTryAgain. This
|
||||
// means that only a portion of the glyphs made it into the atlas, and more must
|
||||
// be processed.
|
||||
// if brokenRun, then the previous call to updateTextureCoordinatesMaybeStrike
|
||||
// exited with kTryAgain. This means that only a portion of the glyphs made it into
|
||||
// the atlas, and more must be processed.
|
||||
fSubRun->fAtlasGeneration =
|
||||
brokenRun ? GrDrawOpAtlas::kInvalidAtlasGeneration
|
||||
: fFullAtlasManager->atlasGeneration(fSubRun->maskFormat());
|
||||
} else {
|
||||
// For the non-texCoords case we need to ensure that we update the associated
|
||||
// use tokens
|
||||
fFullAtlasManager->setUseTokenBulk(*fSubRun->bulkUseToken(),
|
||||
fUploadTarget->tokenTracker()->nextDrawToken(),
|
||||
fSubRun->maskFormat());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -979,9 +965,9 @@ bool GrTextBlob::VertexRegenerator::regenerate(GrTextBlob::VertexRegenerator::Re
|
||||
// this each time.
|
||||
fActions.regenTextureCoordinates |= fSubRun->fAtlasGeneration != currentAtlasGen;
|
||||
|
||||
if (fActions.regenStrike
|
||||
|fActions.regenTextureCoordinates) {
|
||||
return this->doRegen(result, maxGlyphs);
|
||||
if (fActions.regenStrike) { SkASSERT(fActions.regenTextureCoordinates); }
|
||||
if (fActions.regenStrike || fActions.regenTextureCoordinates) {
|
||||
return this->updateTextureCoordinatesMaybeStrike(result, maxGlyphs);
|
||||
} else {
|
||||
auto vertexStride = fSubRun->vertexStride();
|
||||
int glyphsLeft = fSubRun->fGlyphs.size() - fCurrGlyph;
|
||||
|
@ -322,7 +322,7 @@ public:
|
||||
bool regenerate(Result*, int maxGlyphs = std::numeric_limits<int>::max());
|
||||
|
||||
private:
|
||||
bool doRegen(Result* result, int maxGlyphs);
|
||||
bool updateTextureCoordinatesMaybeStrike(Result* result, int maxGlyphs);
|
||||
|
||||
GrResourceProvider* fResourceProvider;
|
||||
GrDeferredUploadTarget* fUploadTarget;
|
||||
|
Loading…
Reference in New Issue
Block a user