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

Side by Side Diff: src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp

Issue 1467553002: New API for computing optimization invariants. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « src/gpu/batches/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/batches/GrAAStrokeRectBatch.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrAALinearizingConvexPathRenderer.h" 9 #include "GrAALinearizingConvexPathRenderer.h"
10 10
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 SkPaint::Join fJoin; 128 SkPaint::Join fJoin;
129 SkScalar fMiterLimit; 129 SkScalar fMiterLimit;
130 }; 130 };
131 131
132 static GrDrawBatch* Create(const Geometry& geometry) { 132 static GrDrawBatch* Create(const Geometry& geometry) {
133 return new AAFlatteningConvexPathBatch(geometry); 133 return new AAFlatteningConvexPathBatch(geometry);
134 } 134 }
135 135
136 const char* name() const override { return "AAConvexBatch"; } 136 const char* name() const override { return "AAConvexBatch"; }
137 137
138 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { 138 void computePipelineOptimizations(GrInitInvariantOutput* color,
139 GrInitInvariantOutput* coverage,
140 GrBatchToXPOverrides* overrides) const ove rride {
139 // When this is called on a batch, there is only one geometry bundle 141 // When this is called on a batch, there is only one geometry bundle
140 out->setKnownFourComponents(fGeoData[0].fColor); 142 color->setKnownFourComponents(fGeoData[0].fColor);
141 } 143 coverage->setUnknownSingleComponent();
142 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { 144 overrides->fUsePLSDstRead = false;
143 out->setUnknownSingleComponent();
144 } 145 }
145 146
146 private: 147 private:
147 void initBatchTracker(const GrPipelineOptimizations& opt) override { 148 void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
148 // Handle any color overrides 149 // Handle any color overrides
149 if (!opt.readsColor()) { 150 if (!overrides.readsColor()) {
150 fGeoData[0].fColor = GrColor_ILLEGAL; 151 fGeoData[0].fColor = GrColor_ILLEGAL;
151 } 152 }
152 opt.getOverrideColorIfSet(&fGeoData[0].fColor); 153 overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
153 154
154 // setup batch properties 155 // setup batch properties
155 fBatch.fColorIgnored = !opt.readsColor(); 156 fBatch.fColorIgnored = !overrides.readsColor();
156 fBatch.fColor = fGeoData[0].fColor; 157 fBatch.fColor = fGeoData[0].fColor;
157 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); 158 fBatch.fUsesLocalCoords = overrides.readsLocalCoords();
158 fBatch.fCoverageIgnored = !opt.readsCoverage(); 159 fBatch.fCoverageIgnored = !overrides.readsCoverage();
159 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe gmentMasks(); 160 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe gmentMasks();
160 fBatch.fCanTweakAlphaForCoverage = opt.canTweakAlphaForCoverage(); 161 fBatch.fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage();
161 } 162 }
162 163
163 void draw(GrVertexBatch::Target* target, const GrPipeline* pipeline, int ver texCount, 164 void draw(GrVertexBatch::Target* target, const GrPipeline* pipeline, int ver texCount,
164 size_t vertexStride, void* vertices, int indexCount, uint16_t* indic es) { 165 size_t vertexStride, void* vertices, int indexCount, uint16_t* indic es) {
165 if (vertexCount == 0 || indexCount == 0) { 166 if (vertexCount == 0 || indexCount == 0) {
166 return; 167 return;
167 } 168 }
168 const GrVertexBuffer* vertexBuffer; 169 const GrVertexBuffer* vertexBuffer;
169 GrVertices info; 170 GrVertices info;
170 int firstVertex; 171 int firstVertex;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { 348 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) {
348 AAFlatteningConvexPathBatch::Geometry geometry; 349 AAFlatteningConvexPathBatch::Geometry geometry;
349 geometry.fColor = GrRandomColor(random); 350 geometry.fColor = GrRandomColor(random);
350 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 351 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
351 geometry.fPath = GrTest::TestPathConvex(random); 352 geometry.fPath = GrTest::TestPathConvex(random);
352 353
353 return AAFlatteningConvexPathBatch::Create(geometry); 354 return AAFlatteningConvexPathBatch::Create(geometry);
354 } 355 }
355 356
356 #endif 357 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/batches/GrAAStrokeRectBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698