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

Unified Diff: src/gpu/GrAALinearizingConvexPathRenderer.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/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAALinearizingConvexPathRenderer.cpp
diff --git a/src/gpu/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/GrAALinearizingConvexPathRenderer.cpp
index 69f9d1cca10f41a55462c2f12f0b26932db9f6d8..e4b592af3c9b5f143d1b56a216fe89d88886bf8c 100644
--- a/src/gpu/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/GrAALinearizingConvexPathRenderer.cpp
@@ -93,16 +93,25 @@ static void extract_verts(const GrAAConvexTessellator& tess,
}
static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage,
- const SkMatrix& localMatrix,
+ const SkMatrix& viewMatrix,
bool usesLocalCoords,
bool coverageIgnored) {
- uint32_t flags = GrDefaultGeoProcFactory::kColor_GPType;
- if (!tweakAlphaForCoverage) {
- flags |= GrDefaultGeoProcFactory::kCoverage_GPType;
+ using namespace GrDefaultGeoProcFactory;
+
+ Color color(Color::kAttribute_Type);
+ Coverage::Type coverageType;
+ // TODO remove coverage if coverage is ignored
+ /*if (coverageIgnored) {
+ coverageType = Coverage::kNone_Type;
+ } else*/ if (tweakAlphaForCoverage) {
+ coverageType = Coverage::kSolid_Type;
+ } else {
+ coverageType = Coverage::kAttribute_Type;
}
-
- return GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords, coverageIgnored,
- SkMatrix::I(), localMatrix);
+ Coverage coverage(coverageType);
+ LocalCoords localCoords(usesLocalCoords ? LocalCoords::kUsePosition_Type :
+ LocalCoords::kUnused_Type);
+ return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix);
}
class AAFlatteningConvexPathBatch : public GrBatch {
@@ -178,18 +187,16 @@ public:
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
- SkMatrix invert;
- if (this->usesLocalCoords() && !this->viewMatrix().invert(&invert)) {
- SkDebugf("Could not invert viewmatrix\n");
+ // Setup GrGeometryProcessor
+ SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_gp(canTweakAlphaForCoverage,
+ this->viewMatrix(),
+ this->usesLocalCoords(),
+ this->coverageIgnored()));
+ if (!gp) {
+ SkDebugf("Couldn't create a GrGeometryProcessor\n");
return;
}
- // Setup GrGeometryProcessor
- SkAutoTUnref<const GrGeometryProcessor> gp(
- create_fill_gp(canTweakAlphaForCoverage, invert,
- this->usesLocalCoords(),
- this->coverageIgnored()));
-
batchTarget->initDraw(gp, pipeline);
size_t vertexStride = gp->getVertexStride();
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698