Index: src/gpu/GrAARectRenderer.cpp |
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp |
index 7710bf71c2eee021faa705c5add03617f3ea0475..ffee841464332060f3ca85397ac72304b1856a02 100644 |
--- a/src/gpu/GrAARectRenderer.cpp |
+++ b/src/gpu/GrAARectRenderer.cpp |
@@ -32,24 +32,20 @@ |
} |
static const GrGeometryProcessor* create_fill_rect_gp(bool tweakAlphaForCoverage, |
- const SkMatrix& viewMatrix, |
+ const SkMatrix& localMatrix, |
bool usesLocalCoords, |
bool coverageIgnored) { |
- using namespace GrDefaultGeoProcFactory; |
- |
- Color color(Color::kAttribute_Type); |
- Coverage::Type coverageType; |
- if (coverageIgnored) { |
- coverageType = Coverage::kNone_Type; |
- } else if (tweakAlphaForCoverage) { |
- coverageType = Coverage::kSolid_Type; |
+ uint32_t flags = GrDefaultGeoProcFactory::kColor_GPType; |
+ const GrGeometryProcessor* gp; |
+ if (tweakAlphaForCoverage) { |
+ gp = GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords, coverageIgnored, |
+ SkMatrix::I(), localMatrix); |
} else { |
- coverageType = Coverage::kAttribute_Type; |
- } |
- Coverage coverage(coverageType); |
- LocalCoords localCoords(usesLocalCoords ? LocalCoords::kUsePosition_Type : |
- LocalCoords::kUnused_Type); |
- return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix); |
+ flags |= GrDefaultGeoProcFactory::kCoverage_GPType; |
+ gp = GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords, coverageIgnored, |
+ SkMatrix::I(), localMatrix); |
+ } |
+ return gp; |
} |
GR_DECLARE_STATIC_UNIQUE_KEY(gAAFillRectIndexBufferKey); |
@@ -96,14 +92,16 @@ |
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { |
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); |
+ SkMatrix localMatrix; |
+ if (this->usesLocalCoords() && !this->viewMatrix().invert(&localMatrix)) { |
+ SkDebugf("Cannot invert\n"); |
+ return; |
+ } |
+ |
SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_rect_gp(canTweakAlphaForCoverage, |
- this->viewMatrix(), |
+ localMatrix, |
this->usesLocalCoords(), |
this->coverageIgnored())); |
- if (!gp) { |
- SkDebugf("Couldn't create GrGeometryProcessor\n"); |
- return; |
- } |
batchTarget->initDraw(gp, pipeline); |
@@ -446,14 +444,18 @@ |
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { |
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); |
+ // Local matrix is ignored if we don't have local coords. If we have localcoords we only |
+ // batch with identical view matrices |
+ SkMatrix localMatrix; |
+ if (this->usesLocalCoords() && !this->viewMatrix().invert(&localMatrix)) { |
+ SkDebugf("Cannot invert\n"); |
+ return; |
+ } |
+ |
SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_rect_gp(canTweakAlphaForCoverage, |
- this->viewMatrix(), |
+ localMatrix, |
this->usesLocalCoords(), |
this->coverageIgnored())); |
- if (!gp) { |
- SkDebugf("Couldn't create GrGeometryProcessor\n"); |
- return; |
- } |
batchTarget->initDraw(gp, pipeline); |