aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrRectBatch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrRectBatch.cpp')
-rw-r--r--src/gpu/GrRectBatch.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/gpu/GrRectBatch.cpp b/src/gpu/GrRectBatch.cpp
index 100aafc4ca..bf085bdfdf 100644
--- a/src/gpu/GrRectBatch.cpp
+++ b/src/gpu/GrRectBatch.cpp
@@ -25,15 +25,19 @@
The vertex attrib order is always pos, color, [local coords].
*/
static const GrGeometryProcessor* create_rect_gp(bool hasExplicitLocalCoords,
- GrColor color,
- const SkMatrix* localMatrix) {
+ const SkMatrix* localMatrix,
+ bool usesLocalCoords,
+ bool coverageIgnored) {
+ // TODO remove color when we have ignored color from the XP
uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType |
GrDefaultGeoProcFactory::kColor_GPType;
flags |= hasExplicitLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPType : 0;
if (localMatrix) {
- return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), *localMatrix);
+ return GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords,
+ coverageIgnored, SkMatrix::I(), *localMatrix);
} else {
- return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), SkMatrix::I());
+ return GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords,
+ coverageIgnored, SkMatrix::I(), SkMatrix::I());
}
}
@@ -98,21 +102,12 @@ public:
}
SkAutoTUnref<const GrGeometryProcessor> gp(create_rect_gp(hasExplicitLocalCoords,
- this->color(),
- &invert));
+ &invert,
+ 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);
-
int instanceCount = fGeoData.count();
size_t vertexStride = gp->getVertexStride();
SkASSERT(hasExplicitLocalCoords ?
@@ -176,6 +171,7 @@ private:
const SkMatrix& localMatrix() const { return fGeoData[0].fLocalMatrix; }
bool hasLocalRect() const { return fGeoData[0].fHasLocalRect; }
bool hasLocalMatrix() const { return fGeoData[0].fHasLocalMatrix; }
+ bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
bool onCombineIfPossible(GrBatch* t) override {
RectBatch* that = t->cast<RectBatch>();