Push GrPipelineBuilder down to the drawBatch calls in the TextContext
This is split out of https://codereview.chromium.org/2092893003/ (Retract PipelineBuilder some more)
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2155983003
Review-Url: https://codereview.chromium.org/2155983003
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index 0ead354..9ab9c12 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -302,9 +302,9 @@
}
inline
-void GrAtlasTextBlob::flushRun(GrDrawContext* dc, GrPipelineBuilder* pipelineBuilder,
+void GrAtlasTextBlob::flushRun(GrDrawContext* dc, const GrPaint& grPaint,
const GrClip& clip, int run, const SkMatrix& viewMatrix, SkScalar x,
- SkScalar y, GrColor color,
+ SkScalar y,
const SkPaint& skPaint, const SkSurfaceProps& props,
const GrDistanceFieldAdjustTable* distanceAdjustTable,
GrBatchFontCache* cache) {
@@ -315,12 +315,17 @@
continue;
}
+ GrColor color = grPaint.getColor();
+
SkAutoTUnref<GrDrawBatch> batch(this->createBatch(info, glyphCount, run,
subRun, viewMatrix, x, y, color,
skPaint, props,
distanceAdjustTable, dc->isGammaCorrect(),
cache));
- dc->drawBatch(*pipelineBuilder, clip, batch);
+
+ GrPipelineBuilder pipelineBuilder(grPaint, dc->mustUseHWAA(grPaint));
+
+ dc->drawBatch(pipelineBuilder, clip, batch);
}
}
@@ -419,10 +424,6 @@
SkScalar x, SkScalar y) {
// We loop through the runs of the blob, flushing each. If any run is too large, then we flush
// it as paths
- GrPipelineBuilder pipelineBuilder(grPaint, dc->mustUseHWAA(grPaint));
-
- GrColor color = grPaint.getColor();
-
SkTextBlobRunIterator it(blob);
for (int run = 0; !it.done(); it.next(), run++) {
if (fRuns[run].fDrawAsPaths) {
@@ -430,7 +431,7 @@
drawFilter, viewMatrix, clipBounds, x, y);
continue;
}
- this->flushRun(dc, &pipelineBuilder, clip, run, viewMatrix, x, y, color, skPaint, props,
+ this->flushRun(dc, grPaint, clip, run, viewMatrix, x, y, skPaint, props,
distanceAdjustTable, context->getBatchFontCache());
}
@@ -448,11 +449,8 @@
const SkMatrix& viewMatrix,
const SkIRect& clipBounds,
SkScalar x, SkScalar y) {
- GrPipelineBuilder pipelineBuilder(grPaint, dc->mustUseHWAA(grPaint));
-
- GrColor color = grPaint.getColor();
for (int run = 0; run < fRunCount; run++) {
- this->flushRun(dc, &pipelineBuilder, clip, run, viewMatrix, x, y, color, skPaint, props,
+ this->flushRun(dc, grPaint, clip, run, viewMatrix, x, y, skPaint, props,
distanceAdjustTable, context->getBatchFontCache());
}