make calls to SubRun and AtlasSubRun const
In theory, all sub runs should be fully const because they are shared by
multiple threads. But, they are used in a single-threaded situation
when flushed to the GPU. AtlasSubRuns are mutate during the GPU flush
to convert PackedGlyphIDs to GrGlyph pointers. Because of that I
decided to make everything const, but label the GrGlyphVector (the
structure that holds the PackedGlyphIDs/GrGlyphs) to be mutable.
Change-Id: I328175a8933b64fda7fab2b3b3d8699683451e60
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304216
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index 6a41ac5..90e6fa9 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -84,8 +84,8 @@
}
void GrAtlasTextOp::Geometry::fillVertexData(void *dst, int offset, int count) const {
- fSubRunPtr->fillVertexData(dst, offset, count, fColor.toBytes_RGBA(),
- fDrawMatrix, fDrawOrigin, fClipRect);
+ fSubRun.fillVertexData(dst, offset, count, fColor.toBytes_RGBA(),
+ fDrawMatrix, fDrawOrigin, fClipRect);
}
void GrAtlasTextOp::visitProxies(const VisitProxyFunc& func) const {
@@ -230,15 +230,15 @@
resetVertexBuffer();
for (const Geometry& geo : SkMakeSpan(fGeoData.get(), fGeoCount)) {
- GrAtlasSubRun* const subRun = geo.fSubRunPtr;
- SkASSERT((int)subRun->vertexStride() == vertexStride);
+ const GrAtlasSubRun& subRun = geo.fSubRun;
+ SkASSERT((int)subRun.vertexStride() == vertexStride);
- const int subRunEnd = subRun->glyphCount();
+ const int subRunEnd = subRun.glyphCount();
for (int subRunCursor = 0; subRunCursor < subRunEnd;) {
// Regenerate the atlas for the remainder of the glyphs in the run, or the remainder
// of the glyphs to fill the vertex buffer.
int regenEnd = subRunCursor + std::min(subRunEnd - subRunCursor, quadEnd - quadCursor);
- auto[ok, glyphsRegenerated] = subRun->regenerateAtlas(subRunCursor, regenEnd, target);
+ auto[ok, glyphsRegenerated] = subRun.regenerateAtlas(subRunCursor, regenEnd, target);
// There was a problem allocating the glyph in the atlas. Bail.
if (!ok) {
return;