Non-substantive GPU text changes
This CL pulls some cleanup changes out of the omnibus GPU text CL. It: Removes the unused GrTextStrike::removeID method Removes the unused GrTextStrike::countGlyphs method Removes the GrTextureStrike::fAtlasedGlyphs member variable Adds an "int SkSpan::count() const" helper method Change-Id: I88eefd929a5576093de58af85582567d8df5610a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280706 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Herb Derby <herb@google.com>
This commit is contained in:
parent
4eaa5f2eb1
commit
1576e4edf0
@ -222,7 +222,6 @@ void GrAtlasTextOp::finalizeForTextTarget(uint32_t color, const GrCaps& caps) {
|
||||
}
|
||||
|
||||
void GrAtlasTextOp::executeForTextTarget(SkAtlasTextTarget* target) {
|
||||
FlushInfo flushInfo;
|
||||
auto& context = target->context()->internal();
|
||||
auto atlasManager = context.grContext()->priv().getAtlasManager();
|
||||
auto resourceProvider = context.grContext()->priv().resourceProvider();
|
||||
@ -239,10 +238,12 @@ void GrAtlasTextOp::executeForTextTarget(SkAtlasTextTarget* target) {
|
||||
subRun->translateVerticesIfNeeded(fGeoData[i].fDrawMatrix, fGeoData[i].fDrawOrigin);
|
||||
GrTextBlob::VertexRegenerator regenerator(
|
||||
resourceProvider, fGeoData[i].fSubRunPtr, &context, atlasManager);
|
||||
int subRunEnd = subRun->fGlyphs.size();
|
||||
int subRunEnd = subRun->fGlyphs.count();
|
||||
for (int subRunIndex = 0; subRunIndex < subRunEnd;) {
|
||||
auto [ok, glyphsRegenerated] = regenerator.regenerate(subRunIndex, subRunEnd);
|
||||
if (!ok) { break; }
|
||||
if (!ok) {
|
||||
break;
|
||||
}
|
||||
|
||||
context.recordDraw(subRun->quadStart(subRunIndex), glyphsRegenerated,
|
||||
fGeoData[i].fDrawMatrix, target->handle());
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
constexpr auto crbegin() const { return std::make_reverse_iterator(this->cend()); }
|
||||
constexpr auto crend() const { return std::make_reverse_iterator(this->cbegin()); }
|
||||
constexpr T* data() const { return fPtr; }
|
||||
constexpr int count() const { return SkTo<int>(fSize); }
|
||||
constexpr size_t size() const { return fSize; }
|
||||
constexpr bool empty() const { return fSize == 0; }
|
||||
constexpr size_t size_bytes() const { return fSize * sizeof(T); }
|
||||
|
@ -367,7 +367,7 @@ void GrAtlasTextOp::onPrepareDraws(Target* target) {
|
||||
|
||||
// Where the subRun begins and ends relative to totalGlyphsRegened.
|
||||
int subRunBegin = totalGlyphsRegened;
|
||||
int subRunEnd = subRunBegin + (int)subRun->fGlyphs.size();
|
||||
int subRunEnd = subRunBegin + subRun->fGlyphs.count();
|
||||
|
||||
// Draw all the glyphs in the subRun.
|
||||
while (totalGlyphsRegened < subRunEnd) {
|
||||
@ -379,7 +379,9 @@ void GrAtlasTextOp::onPrepareDraws(Target* target) {
|
||||
auto[ok, glyphsRegenerated] = regenerator.regenerate(drawBegin, drawEnd);
|
||||
|
||||
// There was a problem allocating the glyph in the atlas. Bail.
|
||||
if(!ok) { return; }
|
||||
if (!ok) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update all the vertices for glyphsRegenerate glyphs.
|
||||
if (glyphsRegenerated > 0) {
|
||||
|
@ -139,16 +139,6 @@ static void get_packed_glyph_image(
|
||||
GrTextStrike::GrTextStrike(const SkDescriptor& key)
|
||||
: fFontScalerKey(key) {}
|
||||
|
||||
void GrTextStrike::removeID(GrDrawOpAtlas::PlotLocator plotLocator) {
|
||||
fCache.foreach([this, plotLocator](GrGlyph** glyph){
|
||||
if ((*glyph)->fPlotLocator == plotLocator) {
|
||||
(*glyph)->fPlotLocator = GrDrawOpAtlas::kInvalidPlotLocator;
|
||||
fAtlasedGlyphs--;
|
||||
SkASSERT(fAtlasedGlyphs >= 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
GrDrawOpAtlas::ErrorCode GrTextStrike::addGlyphToAtlas(const SkGlyph& skGlyph,
|
||||
GrMaskFormat expectedMaskFormat,
|
||||
bool isScaledGlyph,
|
||||
@ -194,7 +184,6 @@ GrDrawOpAtlas::ErrorCode GrTextStrike::addGlyphToAtlas(const SkGlyph& skGlyph,
|
||||
grGlyph->fAtlasLocation.fY += 1;
|
||||
}
|
||||
SkASSERT(grGlyph->fPlotLocator != GrDrawOpAtlas::kInvalidPlotLocator);
|
||||
fAtlasedGlyphs++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -46,12 +46,6 @@ public:
|
||||
GrAtlasManager*,
|
||||
GrGlyph*);
|
||||
|
||||
// testing
|
||||
int countGlyphs() const { return fCache.count(); }
|
||||
|
||||
// remove any references to this plot
|
||||
void removeID(GrDrawOpAtlas::PlotLocator);
|
||||
|
||||
private:
|
||||
struct HashTraits {
|
||||
// GetKey and Hash for the the hash table.
|
||||
@ -67,8 +61,6 @@ private:
|
||||
SkAutoDescriptor fFontScalerKey;
|
||||
SkArenaAlloc fAlloc{512};
|
||||
|
||||
int fAtlasedGlyphs{0};
|
||||
|
||||
friend class GrStrikeCache;
|
||||
};
|
||||
|
||||
|
@ -531,7 +531,7 @@ void GrTextBlob::flush(GrTextTarget* target, const SkSurfaceProps& props,
|
||||
target->drawShape(clip, runPaint, ctm, shape);
|
||||
}
|
||||
} else {
|
||||
int glyphCount = subRun->fGlyphs.size();
|
||||
int glyphCount = subRun->fGlyphs.count();
|
||||
if (0 == glyphCount) {
|
||||
continue;
|
||||
}
|
||||
@ -853,7 +853,7 @@ std::tuple<bool, int> GrTextBlob::VertexRegenerator::regenerate(int begin, int e
|
||||
auto [success, glyphsPlacedInAtlas] = this->updateTextureCoordinates(begin, end);
|
||||
|
||||
// Update atlas generation if there are no more glyphs to put in the atlas.
|
||||
if (success && begin + glyphsPlacedInAtlas == (int)fSubRun->fGlyphs.size()) {
|
||||
if (success && begin + glyphsPlacedInAtlas == fSubRun->fGlyphs.count()) {
|
||||
// Need to get the freshest value of the atlas' generation because
|
||||
// updateTextureCoordinates may have changed it.
|
||||
fSubRun->fAtlasGeneration = fFullAtlasManager->atlasGeneration(fSubRun->maskFormat());
|
||||
@ -861,7 +861,7 @@ std::tuple<bool, int> GrTextBlob::VertexRegenerator::regenerate(int begin, int e
|
||||
return {success, glyphsPlacedInAtlas};
|
||||
} else {
|
||||
// The atlas hasn't changed, so our texture coordinates are still valid.
|
||||
if (end == (int)fSubRun->fGlyphs.size()) {
|
||||
if (end == fSubRun->fGlyphs.count()) {
|
||||
// The atlas hasn't changed and the texture coordinates are all still valid. Update
|
||||
// all the plots used to the new use token.
|
||||
fFullAtlasManager->setUseTokenBulk(*fSubRun->bulkUseToken(),
|
||||
|
Loading…
Reference in New Issue
Block a user