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

Unified Diff: src/gpu/GrAARectRenderer.cpp

Issue 1264283004: Revert of Use new API everywhere for GrDefaultGeoProcFactory (Closed) Base URL: https://skia.googlesource.com/skia.git@lccleanup2
Patch Set: 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/GrAALinearizingConvexPathRenderer.cpp ('k') | src/gpu/GrDefaultGeoProcFactory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAARectRenderer.cpp
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index 7710bf71c2eee021faa705c5add03617f3ea0475..ffee841464332060f3ca85397ac72304b1856a02 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -32,24 +32,20 @@
}
static const GrGeometryProcessor* create_fill_rect_gp(bool tweakAlphaForCoverage,
- const SkMatrix& viewMatrix,
+ const SkMatrix& localMatrix,
bool usesLocalCoords,
bool coverageIgnored) {
- using namespace GrDefaultGeoProcFactory;
-
- Color color(Color::kAttribute_Type);
- Coverage::Type coverageType;
- if (coverageIgnored) {
- coverageType = Coverage::kNone_Type;
- } else if (tweakAlphaForCoverage) {
- coverageType = Coverage::kSolid_Type;
+ uint32_t flags = GrDefaultGeoProcFactory::kColor_GPType;
+ const GrGeometryProcessor* gp;
+ if (tweakAlphaForCoverage) {
+ gp = GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords, coverageIgnored,
+ SkMatrix::I(), localMatrix);
} else {
- coverageType = Coverage::kAttribute_Type;
- }
- Coverage coverage(coverageType);
- LocalCoords localCoords(usesLocalCoords ? LocalCoords::kUsePosition_Type :
- LocalCoords::kUnused_Type);
- return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix);
+ flags |= GrDefaultGeoProcFactory::kCoverage_GPType;
+ gp = GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords, coverageIgnored,
+ SkMatrix::I(), localMatrix);
+ }
+ return gp;
}
GR_DECLARE_STATIC_UNIQUE_KEY(gAAFillRectIndexBufferKey);
@@ -96,14 +92,16 @@
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
+ SkMatrix localMatrix;
+ if (this->usesLocalCoords() && !this->viewMatrix().invert(&localMatrix)) {
+ SkDebugf("Cannot invert\n");
+ return;
+ }
+
SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_rect_gp(canTweakAlphaForCoverage,
- this->viewMatrix(),
+ localMatrix,
this->usesLocalCoords(),
this->coverageIgnored()));
- if (!gp) {
- SkDebugf("Couldn't create GrGeometryProcessor\n");
- return;
- }
batchTarget->initDraw(gp, pipeline);
@@ -446,14 +444,18 @@
void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
+ // Local matrix is ignored if we don't have local coords. If we have localcoords we only
+ // batch with identical view matrices
+ SkMatrix localMatrix;
+ if (this->usesLocalCoords() && !this->viewMatrix().invert(&localMatrix)) {
+ SkDebugf("Cannot invert\n");
+ return;
+ }
+
SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_rect_gp(canTweakAlphaForCoverage,
- this->viewMatrix(),
+ localMatrix,
this->usesLocalCoords(),
this->coverageIgnored()));
- if (!gp) {
- SkDebugf("Couldn't create GrGeometryProcessor\n");
- return;
- }
batchTarget->initDraw(gp, pipeline);
« no previous file with comments | « src/gpu/GrAALinearizingConvexPathRenderer.cpp ('k') | src/gpu/GrDefaultGeoProcFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698