Index: src/gpu/effects/GrDashingEffect.cpp |
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp |
index afb09b9539c678f6217ec8be6382f5f62efc9b00..550823aacb9e2b8ce5fdcf0b17f4b9c229bd0198 100644 |
--- a/src/gpu/effects/GrDashingEffect.cpp |
+++ b/src/gpu/effects/GrDashingEffect.cpp |
@@ -300,28 +300,30 @@ |
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { |
int instanceCount = fGeoData.count(); |
+ |
+ SkMatrix invert; |
+ if (this->usesLocalCoords() && !this->viewMatrix().invert(&invert)) { |
+ SkDebugf("Failed to invert\n"); |
+ return; |
+ } |
+ |
SkPaint::Cap cap = this->cap(); |
+ |
+ SkAutoTUnref<const GrGeometryProcessor> gp; |
+ |
bool isRoundCap = SkPaint::kRound_Cap == cap; |
DashCap capType = isRoundCap ? kRound_DashCap : kNonRound_DashCap; |
- |
- SkAutoTUnref<const GrGeometryProcessor> gp; |
if (this->fullDash()) { |
- gp.reset(create_dash_gp(this->color(), this->aaMode(), capType, this->viewMatrix(), |
+ gp.reset(create_dash_gp(this->color(), this->aaMode(), capType, invert, |
this->usesLocalCoords())); |
} else { |
// Set up the vertex data for the line and start/end dashes |
- using namespace GrDefaultGeoProcFactory; |
- Color color(this->color()); |
- Coverage coverage(this->coverageIgnored() ? Coverage::kNone_Type : |
- Coverage::kSolid_Type); |
- LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUsePosition_Type : |
- LocalCoords::kUnused_Type); |
- gp.reset(CreateForDeviceSpace(color, coverage, localCoords, this->viewMatrix())); |
- } |
- |
- if (!gp) { |
- SkDebugf("Could not create GrGeometryProcessor\n"); |
- return; |
+ gp.reset(GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPosition_GPType, |
+ this->color(), |
+ this->usesLocalCoords(), |
+ this->coverageIgnored(), |
+ SkMatrix::I(), |
+ invert)); |
} |
batchTarget->initDraw(gp, pipeline); |
@@ -1207,19 +1209,15 @@ |
static GrGeometryProcessor* create_dash_gp(GrColor color, |
DashAAMode dashAAMode, |
DashCap cap, |
- const SkMatrix& viewMatrix, |
+ const SkMatrix& localMatrix, |
bool usesLocalCoords) { |
- SkMatrix invert; |
- if (usesLocalCoords && !viewMatrix.invert(&invert)) { |
- SkDebugf("Failed to invert\n"); |
- return NULL; |
- } |
- |
switch (cap) { |
case kRound_DashCap: |
- return DashingCircleEffect::Create(color, dashAAMode, invert, usesLocalCoords); |
+ return DashingCircleEffect::Create(color, dashAAMode, localMatrix, usesLocalCoords); |
case kNonRound_DashCap: |
- return DashingLineEffect::Create(color, dashAAMode, invert, usesLocalCoords); |
+ return DashingLineEffect::Create(color, dashAAMode, localMatrix, usesLocalCoords); |
+ default: |
+ SkFAIL("Unexpected dashed cap."); |
} |
return NULL; |
} |