Index: src/gpu/GrDrawContext.cpp |
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp |
index 5a496d2517cfc0dbd5018a02c742b6d9d5d522cf..1a7734d0f808f8e6f7932af46ed37122566a77e1 100644 |
--- a/src/gpu/GrDrawContext.cpp |
+++ b/src/gpu/GrDrawContext.cpp |
@@ -288,13 +288,17 @@ public: |
} |
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { |
- SkAutoTUnref<const GrGeometryProcessor> gp( |
- GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPosition_GPType, |
- this->color(), |
- this->usesLocalCoords(), |
- this->coverageIgnored(), |
- this->viewMatrix(), |
- SkMatrix::I())); |
+ SkAutoTUnref<const GrGeometryProcessor> gp; |
+ { |
+ using namespace GrDefaultGeoProcFactory; |
+ Color color(this->color()); |
+ Coverage coverage(this->coverageIgnored() ? Coverage::kSolid_Type : |
+ Coverage::kNone_Type); |
+ LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUsePosition_Type : |
+ LocalCoords::kUnused_Type); |
+ gp.reset(GrDefaultGeoProcFactory::Create(color, coverage, localCoords, |
+ this->viewMatrix())); |
+ } |
batchTarget->initDraw(gp, pipeline); |
@@ -560,23 +564,26 @@ static const GrGeometryProcessor* set_vertex_attributes(bool hasLocalCoords, |
GrColor color, |
const SkMatrix& viewMatrix, |
bool coverageIgnored) { |
+ using namespace GrDefaultGeoProcFactory; |
*texOffset = -1; |
*colorOffset = -1; |
- uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType; |
+ Color gpColor(color); |
+ if (hasColors) { |
+ gpColor.fType = Color::kAttribute_Type; |
+ } |
+ |
+ Coverage coverage(coverageIgnored ? Coverage::kNone_Type : Coverage::kSolid_Type); |
+ LocalCoords localCoords(hasLocalCoords ? LocalCoords::kHasExplicit_Type : |
+ LocalCoords::kUsePosition_Type); |
if (hasLocalCoords && hasColors) { |
*colorOffset = sizeof(SkPoint); |
*texOffset = sizeof(SkPoint) + sizeof(GrColor); |
- flags |= GrDefaultGeoProcFactory::kColor_GPType | |
- GrDefaultGeoProcFactory::kLocalCoord_GPType; |
} else if (hasLocalCoords) { |
*texOffset = sizeof(SkPoint); |
- flags |= GrDefaultGeoProcFactory::kLocalCoord_GPType; |
} else if (hasColors) { |
*colorOffset = sizeof(SkPoint); |
- flags |= GrDefaultGeoProcFactory::kColor_GPType; |
} |
- return GrDefaultGeoProcFactory::Create(flags, color, hasLocalCoords, coverageIgnored, |
- viewMatrix, SkMatrix::I()); |
+ return GrDefaultGeoProcFactory::Create(gpColor, coverage, localCoords, viewMatrix); |
} |
class DrawVerticesBatch : public GrBatch { |