Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Unified Diff: src/gpu/batches/GrAtlasTextBatch.cpp

Issue 1835283002: Simplify GrDrawBatch uploads and token uage. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/batches/GrAtlasTextBatch.h ('k') | src/gpu/batches/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrAtlasTextBatch.cpp
diff --git a/src/gpu/batches/GrAtlasTextBatch.cpp b/src/gpu/batches/GrAtlasTextBatch.cpp
index 0bbf8c06d644ba6d101e83e9326993b19c121027..ca6b99ea336312d51282339c547b82575ae12f64 100644
--- a/src/gpu/batches/GrAtlasTextBatch.cpp
+++ b/src/gpu/batches/GrAtlasTextBatch.cpp
@@ -97,27 +97,25 @@ void GrAtlasTextBatch::onPrepareDraws(Target* target) const {
GrMaskFormat maskFormat = this->maskFormat();
- SkAutoTUnref<const GrGeometryProcessor> gp;
+ FlushInfo flushInfo;
if (this->usesDistanceFields()) {
- gp.reset(this->setupDfProcessor(this->viewMatrix(), fFilteredColor, this->color(),
- texture));
+ flushInfo.fGeometryProcessor.reset(
+ this->setupDfProcessor(this->viewMatrix(), fFilteredColor, this->color(), texture));
} else {
GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode);
- gp.reset(GrBitmapTextGeoProc::Create(this->color(),
- texture,
- params,
- maskFormat,
- localMatrix,
- this->usesLocalCoords()));
+ flushInfo.fGeometryProcessor.reset(
+ GrBitmapTextGeoProc::Create(this->color(),
+ texture,
+ params,
+ maskFormat,
+ localMatrix,
+ this->usesLocalCoords()));
}
- FlushInfo flushInfo;
flushInfo.fGlyphsToFlush = 0;
- size_t vertexStride = gp->getVertexStride();
+ size_t vertexStride = flushInfo.fGeometryProcessor->getVertexStride();
SkASSERT(vertexStride == GrAtlasTextBlob::GetVertexStride(maskFormat));
- target->initDraw(gp);
-
int glyphCount = this->numGlyphs();
const GrBuffer* vertexBuffer;
@@ -141,7 +139,7 @@ void GrAtlasTextBatch::onPrepareDraws(Target* target) const {
GrFontScaler* scaler = nullptr;
SkTypeface* typeface = nullptr;
- GrBlobRegenHelper helper(this, target, &flushInfo, gp);
+ GrBlobRegenHelper helper(this, target, &flushInfo);
for (int i = 0; i < fGeoCount; i++) {
const Geometry& args = fGeoData[i];
@@ -187,7 +185,7 @@ void GrAtlasTextBatch::flush(GrVertexBatch::Target* target, FlushInfo* flushInfo
flushInfo->fIndexBuffer, flushInfo->fVertexOffset,
kVerticesPerGlyph, kIndicesPerGlyph, flushInfo->fGlyphsToFlush,
maxGlyphsPerDraw);
- target->draw(mesh);
+ target->draw(flushInfo->fGeometryProcessor, mesh);
flushInfo->fVertexOffset += kVerticesPerGlyph * flushInfo->fGlyphsToFlush;
flushInfo->fGlyphsToFlush = 0;
}
@@ -314,5 +312,4 @@ GrGeometryProcessor* GrAtlasTextBatch::setupDfProcessor(const SkMatrix& viewMatr
void GrBlobRegenHelper::flush() {
fBatch->flush(fTarget, fFlushInfo);
- fTarget->initDraw(fGP);
}
« no previous file with comments | « src/gpu/batches/GrAtlasTextBatch.h ('k') | src/gpu/batches/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698