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

Unified Diff: src/gpu/effects/GrDashingEffect.cpp

Issue 1261083003: Use new API everywhere for GrDefaultGeoProcFactory (Closed) Base URL: https://skia.googlesource.com/skia.git@lccleanup2
Patch Set: tweaks Created 5 years, 4 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/GrTessellatingPathRenderer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrDashingEffect.cpp
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 550823aacb9e2b8ce5fdcf0b17f4b9c229bd0198..afb09b9539c678f6217ec8be6382f5f62efc9b00 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -300,30 +300,28 @@ public:
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, invert,
+ gp.reset(create_dash_gp(this->color(), this->aaMode(), capType, this->viewMatrix(),
this->usesLocalCoords()));
} else {
// Set up the vertex data for the line and start/end dashes
- gp.reset(GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPosition_GPType,
- this->color(),
- this->usesLocalCoords(),
- this->coverageIgnored(),
- SkMatrix::I(),
- invert));
+ 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;
}
batchTarget->initDraw(gp, pipeline);
@@ -1209,15 +1207,19 @@ GrGeometryProcessor* DashingLineEffect::TestCreate(GrProcessorTestData* d) {
static GrGeometryProcessor* create_dash_gp(GrColor color,
DashAAMode dashAAMode,
DashCap cap,
- const SkMatrix& localMatrix,
+ const SkMatrix& viewMatrix,
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, localMatrix, usesLocalCoords);
+ return DashingCircleEffect::Create(color, dashAAMode, invert, usesLocalCoords);
case kNonRound_DashCap:
- return DashingLineEffect::Create(color, dashAAMode, localMatrix, usesLocalCoords);
- default:
- SkFAIL("Unexpected dashed cap.");
+ return DashingLineEffect::Create(color, dashAAMode, invert, usesLocalCoords);
}
return NULL;
}
« no previous file with comments | « src/gpu/GrTessellatingPathRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698