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

Unified Diff: src/gpu/GrRectBatch.cpp

Issue 1253393002: Cleanup Default Geo Proc API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 5 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/GrDefaultGeoProcFactory.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrRectBatch.cpp
diff --git a/src/gpu/GrRectBatch.cpp b/src/gpu/GrRectBatch.cpp
index 2977fdb1ce4d87feb37a8d0084dcf563c93fd87f..b6c5d74ff27af4b823096f3cdf289ffe448095f4 100644
--- a/src/gpu/GrRectBatch.cpp
+++ b/src/gpu/GrRectBatch.cpp
@@ -25,18 +25,24 @@
*/
static const GrGeometryProcessor* create_rect_gp(bool hasExplicitLocalCoords,
const SkMatrix* localMatrix,
- bool usesLocalCoords,
bool coverageIgnored) {
- // TODO remove color when we have ignored color from the XP
- uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType |
- GrDefaultGeoProcFactory::kColor_GPType;
- flags |= hasExplicitLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPType : 0;
+ typedef GrDefaultGeoProcFactory::Color Color;
+ typedef GrDefaultGeoProcFactory::Coverage Coverage;
+ typedef GrDefaultGeoProcFactory::LocalCoords LocalCoords;
+ Color color(Color::kAttribute_Type);
+ Coverage coverage(coverageIgnored ? Coverage::kNone_Type : Coverage::kSolid_Type);
+ LocalCoords::Type localCoords;
+ if (hasExplicitLocalCoords) {
+ localCoords = LocalCoords::kHasExplicit_Type;
+ } else {
+ localCoords = LocalCoords::kUsePosition_Type;
+ }
+
if (localMatrix) {
- return GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords,
- coverageIgnored, SkMatrix::I(), *localMatrix);
+ return GrDefaultGeoProcFactory::Create(color, coverage, localCoords, SkMatrix::I(),
+ *localMatrix);
} else {
- return GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords,
- coverageIgnored, SkMatrix::I(), SkMatrix::I());
+ return GrDefaultGeoProcFactory::Create(color, coverage, localCoords);
}
}
@@ -101,7 +107,6 @@ public:
SkAutoTUnref<const GrGeometryProcessor> gp(create_rect_gp(hasExplicitLocalCoords,
&invert,
- this->usesLocalCoords(),
this->coverageIgnored()));
batchTarget->initDraw(gp, pipeline);
@@ -129,6 +134,7 @@ public:
geom.fRect.fRight, geom.fRect.fBottom, vertexStride);
geom.fViewMatrix.mapPointsWithStride(positions, vertexStride, kVerticesPerQuad);
+ // TODO we should only do this if local coords are being read
if (geom.fHasLocalRect) {
static const int kLocalOffset = sizeof(SkPoint) + sizeof(GrColor);
SkPoint* coords = reinterpret_cast<SkPoint*>(offset + kLocalOffset);
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698