Simplify VertexRegenerator GrStrikeCache handling
The SubRun has access to the GrStrikeCache pointer, there is no need to pass it around the VertexRegenerator. Change-Id: I867b1b29b29e595f92ad57505dcd27dd0f6b726f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264649 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
62b12feef7
commit
59d529cafa
@ -224,7 +224,6 @@ void GrAtlasTextOp::finalizeForTextTarget(uint32_t color, const GrCaps& caps) {
|
||||
void GrAtlasTextOp::executeForTextTarget(SkAtlasTextTarget* target) {
|
||||
FlushInfo flushInfo;
|
||||
auto& context = target->context()->internal();
|
||||
auto glyphCache = context.grContext()->priv().getGrStrikeCache();
|
||||
auto atlasManager = context.grContext()->priv().getAtlasManager();
|
||||
auto resourceProvider = context.grContext()->priv().resourceProvider();
|
||||
|
||||
@ -239,7 +238,7 @@ void GrAtlasTextOp::executeForTextTarget(SkAtlasTextTarget* target) {
|
||||
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);
|
||||
resourceProvider, fGeoData[i].fSubRunPtr, &context, atlasManager);
|
||||
int subRunEnd = subRun->fGlyphs.size();
|
||||
for (int subRunIndex = 0; subRunIndex < subRunEnd;) {
|
||||
auto [ok, glyphsRegenerated] = regenerator.regenerate(subRunIndex, subRunEnd);
|
||||
|
@ -286,8 +286,6 @@ void GrAtlasTextOp::onPrepareDraws(Target* target) {
|
||||
}
|
||||
|
||||
GrAtlasManager* atlasManager = target->atlasManager();
|
||||
GrStrikeCache* glyphCache = target->glyphCache();
|
||||
|
||||
GrMaskFormat maskFormat = this->maskFormat();
|
||||
|
||||
unsigned int numActiveViews;
|
||||
@ -361,8 +359,7 @@ void GrAtlasTextOp::onPrepareDraws(Target* target) {
|
||||
|
||||
// TODO4F: Preserve float colors
|
||||
GrTextBlob::VertexRegenerator regenerator(
|
||||
resourceProvider, args.fSubRunPtr, target->deferredUploadTarget(), glyphCache,
|
||||
atlasManager);
|
||||
resourceProvider, args.fSubRunPtr, target->deferredUploadTarget(), atlasManager);
|
||||
|
||||
// Where the subRun begins and ends relative to totalGlyphsRegened.
|
||||
int subRunBegin = totalGlyphsRegened;
|
||||
|
@ -127,6 +127,9 @@ void GrTextBlob::SubRun::resetBulkUseToken() { fBulkUseToken.reset(); }
|
||||
GrDrawOpAtlas::BulkUseTokenUpdater* GrTextBlob::SubRun::bulkUseToken() { return &fBulkUseToken; }
|
||||
void GrTextBlob::SubRun::setStrike(sk_sp<GrTextStrike> strike) { fStrike = std::move(strike); }
|
||||
GrTextStrike* GrTextBlob::SubRun::strike() const { return fStrike.get(); }
|
||||
GrStrikeCache* GrTextBlob::SubRun::grStrikeCache() const {
|
||||
return fBlob->fStrikeCache;
|
||||
}
|
||||
GrMaskFormat GrTextBlob::SubRun::maskFormat() const { return fMaskFormat; }
|
||||
size_t GrTextBlob::SubRun::vertexStride() const {
|
||||
return GetVertexStride(this->maskFormat(), this->hasW());
|
||||
@ -780,11 +783,9 @@ void GrTextBlob::processSourceMasks(const SkZip<SkGlyphVariant, SkPoint>& drawab
|
||||
GrTextBlob::VertexRegenerator::VertexRegenerator(GrResourceProvider* resourceProvider,
|
||||
GrTextBlob::SubRun* subRun,
|
||||
GrDeferredUploadTarget* uploadTarget,
|
||||
GrStrikeCache* grStrikeCache,
|
||||
GrAtlasManager* fullAtlasManager)
|
||||
: fResourceProvider(resourceProvider)
|
||||
, fUploadTarget(uploadTarget)
|
||||
, fGrStrikeCache(grStrikeCache)
|
||||
, fFullAtlasManager(fullAtlasManager)
|
||||
, fSubRun(subRun){
|
||||
// Because the GrStrikeCache may evict the strike a blob depends on using for
|
||||
@ -813,7 +814,7 @@ std::tuple<bool, int> GrTextBlob::VertexRegenerator::updateTextureCoordinatesMay
|
||||
|
||||
if (fActions.regenStrike) {
|
||||
// Take the glyphs from the old strike, and translate them a new strike.
|
||||
sk_sp<GrTextStrike> newStrike = strikeSpec.findOrCreateGrStrike(fGrStrikeCache);
|
||||
sk_sp<GrTextStrike> newStrike = strikeSpec.findOrCreateGrStrike(fSubRun->grStrikeCache());
|
||||
|
||||
// Start this batch at the start of the subRun plus any glyphs that were previously
|
||||
// processed.
|
||||
@ -840,8 +841,9 @@ std::tuple<bool, int> GrTextBlob::VertexRegenerator::updateTextureCoordinatesMay
|
||||
|
||||
if (!fFullAtlasManager->hasGlyph(glyph)) {
|
||||
code = grStrike->addGlyphToAtlas(
|
||||
fResourceProvider, fUploadTarget, fGrStrikeCache, fFullAtlasManager, glyph,
|
||||
fMetricsAndImages.get(), fSubRun->maskFormat(), fSubRun->needsTransform());
|
||||
fResourceProvider, fUploadTarget, fSubRun->grStrikeCache(), fFullAtlasManager,
|
||||
glyph, fMetricsAndImages.get(), fSubRun->maskFormat(),
|
||||
fSubRun->needsTransform());
|
||||
if (code != GrDrawOpAtlas::ErrorCode::kSucceeded) {
|
||||
break;
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ public:
|
||||
* SkGlyphCache.
|
||||
*/
|
||||
VertexRegenerator(GrResourceProvider*, GrTextBlob::SubRun* subRun,
|
||||
GrDeferredUploadTarget*, GrStrikeCache*, GrAtlasManager*);
|
||||
GrDeferredUploadTarget*, GrAtlasManager*);
|
||||
|
||||
// Return {success, number of glyphs regenerated}
|
||||
std::tuple<bool, int> regenerate(int begin, int end);
|
||||
@ -308,7 +308,6 @@ private:
|
||||
|
||||
GrResourceProvider* fResourceProvider;
|
||||
GrDeferredUploadTarget* fUploadTarget;
|
||||
GrStrikeCache* fGrStrikeCache;
|
||||
GrAtlasManager* fFullAtlasManager;
|
||||
SkTLazy<SkBulkGlyphMetricsAndImages> fMetricsAndImages;
|
||||
SubRun* fSubRun;
|
||||
@ -341,6 +340,7 @@ public:
|
||||
GrDrawOpAtlas::BulkUseTokenUpdater* bulkUseToken();
|
||||
void setStrike(sk_sp<GrTextStrike> strike);
|
||||
GrTextStrike* strike() const;
|
||||
GrStrikeCache* grStrikeCache() const;
|
||||
|
||||
GrMaskFormat maskFormat() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user