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/GrDrawContext.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/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrRectBatch.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawContext.cpp
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 5a496d2517cfc0dbd5018a02c742b6d9d5d522cf..1a7734d0f808f8e6f7932af46ed37122566a77e1 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -288,13 +288,17 @@ public:
}
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
- SkAutoTUnref<const GrGeometryProcessor> gp(
- GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPosition_GPType,
- this->color(),
- this->usesLocalCoords(),
- this->coverageIgnored(),
- this->viewMatrix(),
- SkMatrix::I()));
+ SkAutoTUnref<const GrGeometryProcessor> gp;
+ {
+ using namespace GrDefaultGeoProcFactory;
+ Color color(this->color());
+ Coverage coverage(this->coverageIgnored() ? Coverage::kSolid_Type :
+ Coverage::kNone_Type);
+ LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUsePosition_Type :
+ LocalCoords::kUnused_Type);
+ gp.reset(GrDefaultGeoProcFactory::Create(color, coverage, localCoords,
+ this->viewMatrix()));
+ }
batchTarget->initDraw(gp, pipeline);
@@ -560,23 +564,26 @@ static const GrGeometryProcessor* set_vertex_attributes(bool hasLocalCoords,
GrColor color,
const SkMatrix& viewMatrix,
bool coverageIgnored) {
+ using namespace GrDefaultGeoProcFactory;
*texOffset = -1;
*colorOffset = -1;
- uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType;
+ Color gpColor(color);
+ if (hasColors) {
+ gpColor.fType = Color::kAttribute_Type;
+ }
+
+ Coverage coverage(coverageIgnored ? Coverage::kNone_Type : Coverage::kSolid_Type);
+ LocalCoords localCoords(hasLocalCoords ? LocalCoords::kHasExplicit_Type :
+ LocalCoords::kUsePosition_Type);
if (hasLocalCoords && hasColors) {
*colorOffset = sizeof(SkPoint);
*texOffset = sizeof(SkPoint) + sizeof(GrColor);
- flags |= GrDefaultGeoProcFactory::kColor_GPType |
- GrDefaultGeoProcFactory::kLocalCoord_GPType;
} else if (hasLocalCoords) {
*texOffset = sizeof(SkPoint);
- flags |= GrDefaultGeoProcFactory::kLocalCoord_GPType;
} else if (hasColors) {
*colorOffset = sizeof(SkPoint);
- flags |= GrDefaultGeoProcFactory::kColor_GPType;
}
- return GrDefaultGeoProcFactory::Create(flags, color, hasLocalCoords, coverageIgnored,
- viewMatrix, SkMatrix::I());
+ return GrDefaultGeoProcFactory::Create(gpColor, coverage, localCoords, viewMatrix);
}
class DrawVerticesBatch : public GrBatch {
« no previous file with comments | « src/gpu/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrRectBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698