aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches/GrAtlasTextBatch.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-04-01 06:06:20 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-01 06:06:20 -0700
commit342bfc25de5b0452b1551bf9db4bf45eac7718b2 (patch)
tree5d54f2ecb1ec17f7848500df30c4f6d40c5b9ae8 /src/gpu/batches/GrAtlasTextBatch.cpp
parent38d68bc31d69ea9793d925dd3c7d4337330b2b7b (diff)
Simplify GrDrawBatch uploads and token uage.
GrVertexBatch subclasses no longer need "initDraw". Simplifies GrTestBatch BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1835283002 Review URL: https://codereview.chromium.org/1835283002
Diffstat (limited to 'src/gpu/batches/GrAtlasTextBatch.cpp')
-rw-r--r--src/gpu/batches/GrAtlasTextBatch.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/gpu/batches/GrAtlasTextBatch.cpp b/src/gpu/batches/GrAtlasTextBatch.cpp
index 0bbf8c06d6..ca6b99ea33 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);
}