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

Unified Diff: src/gpu/GrAARectRenderer.cpp

Issue 1139723004: Preliminary attempt to remove batch tracker (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup5
Patch Set: tweaks Created 5 years, 7 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/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrAtlasTextContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAARectRenderer.cpp
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index 9243e212e4a0c5ee66a40bb7a64a9630faa125a6..005184602b87a22434d28cde90046ace9474df3b 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -31,14 +31,18 @@ static void set_inset_fan(SkPoint* pts, size_t stride,
}
static const GrGeometryProcessor* create_fill_rect_gp(bool tweakAlphaForCoverage,
- const SkMatrix& localMatrix) {
+ const SkMatrix& localMatrix,
+ bool usesLocalCoords,
+ bool coverageIgnored) {
uint32_t flags = GrDefaultGeoProcFactory::kColor_GPType;
const GrGeometryProcessor* gp;
if (tweakAlphaForCoverage) {
- gp = GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, SkMatrix::I(), localMatrix);
+ gp = GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords, coverageIgnored,
+ SkMatrix::I(), localMatrix);
} else {
flags |= GrDefaultGeoProcFactory::kCoverage_GPType;
- gp = GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, SkMatrix::I(), localMatrix);
+ gp = GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords, coverageIgnored,
+ SkMatrix::I(), localMatrix);
}
return gp;
}
@@ -95,20 +99,12 @@ public:
}
SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_rect_gp(canTweakAlphaForCoverage,
- localMatrix));
+ localMatrix,
+ this->usesLocalCoords(),
+ this->coverageIgnored()));
batchTarget->initDraw(gp, pipeline);
- // TODO this is hacky, but the only way we have to initialize the GP is to use the
- // GrPipelineInfo struct so we can generate the correct shader. Once we have GrBatch
- // everywhere we can remove this nastiness
- GrPipelineInfo init;
- init.fColorIgnored = fBatch.fColorIgnored;
- init.fOverrideColor = GrColor_ILLEGAL;
- init.fCoverageIgnored = fBatch.fCoverageIgnored;
- init.fUsesLocalCoords = this->usesLocalCoords();
- gp->initBatchTracker(batchTarget->currentBatchTracker(), init);
-
size_t vertexStride = gp->getVertexStride();
SkASSERT(canTweakAlphaForCoverage ?
vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAttr) :
@@ -176,6 +172,7 @@ private:
bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCoverage; }
bool colorIgnored() const { return fBatch.fColorIgnored; }
const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
+ bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
bool onCombineIfPossible(GrBatch* t) override {
AAFillRectBatch* that = t->cast<AAFillRectBatch>();
@@ -453,20 +450,12 @@ public:
}
SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_rect_gp(canTweakAlphaForCoverage,
- localMatrix));
+ localMatrix,
+ this->usesLocalCoords(),
+ this->coverageIgnored()));
batchTarget->initDraw(gp, pipeline);
- // TODO this is hacky, but the only way we have to initialize the GP is to use the
- // GrPipelineInfo struct so we can generate the correct shader. Once we have GrBatch
- // everywhere we can remove this nastiness
- GrPipelineInfo init;
- init.fColorIgnored = fBatch.fColorIgnored;
- init.fOverrideColor = GrColor_ILLEGAL;
- init.fCoverageIgnored = fBatch.fCoverageIgnored;
- init.fUsesLocalCoords = this->usesLocalCoords();
- gp->initBatchTracker(batchTarget->currentBatchTracker(), init);
-
size_t vertexStride = gp->getVertexStride();
SkASSERT(canTweakAlphaForCoverage ?
@@ -626,6 +615,7 @@ private:
bool colorIgnored() const { return fBatch.fColorIgnored; }
const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; }
bool miterStroke() const { return fBatch.fMiterStroke; }
+ bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
bool onCombineIfPossible(GrBatch* t) override {
AAStrokeRectBatch* that = t->cast<AAStrokeRectBatch>();
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrAtlasTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698