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

Unified Diff: src/gpu/GrAAConvexPathRenderer.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 | « gm/convexpolyeffect.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAAConvexPathRenderer.cpp
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 344b11921cd161023ba30cd896db00be9ff9a8c7..1d4ed2ae115aafad207a2a7c979f65c7134fe023 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -718,16 +718,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 AAConvexPathBatch : public GrBatch {
@@ -771,18 +780,16 @@ public:
void generateGeometryLinesOnly(GrBatchTarget* batchTarget, const GrPipeline* pipeline) {
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("Could not create 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 | « gm/convexpolyeffect.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698