| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrDefaultPathRenderer.h" | 8 #include "GrDefaultPathRenderer.h" |
| 9 | 9 |
| 10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 static GrDrawBatch* Create(const Geometry& geometry, uint8_t coverage, | 222 static GrDrawBatch* Create(const Geometry& geometry, uint8_t coverage, |
| 223 const SkMatrix& viewMatrix, bool isHairline, | 223 const SkMatrix& viewMatrix, bool isHairline, |
| 224 const SkRect& devBounds) { | 224 const SkRect& devBounds) { |
| 225 return new DefaultPathBatch(geometry, coverage, viewMatrix, isHairline,
devBounds); | 225 return new DefaultPathBatch(geometry, coverage, viewMatrix, isHairline,
devBounds); |
| 226 } | 226 } |
| 227 | 227 |
| 228 const char* name() const override { return "DefaultPathBatch"; } | 228 const char* name() const override { return "DefaultPathBatch"; } |
| 229 | 229 |
| 230 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 230 void computePipelineOptimizations(GrInitInvariantOutput* color, |
| 231 GrInitInvariantOutput* coverage, |
| 232 GrBatchToXPOverrides* overrides) const ove
rride { |
| 231 // When this is called on a batch, there is only one geometry bundle | 233 // When this is called on a batch, there is only one geometry bundle |
| 232 out->setKnownFourComponents(fGeoData[0].fColor); | 234 color->setKnownFourComponents(fGeoData[0].fColor); |
| 233 } | 235 coverage->setKnownSingleComponent(this->coverage()); |
| 234 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 236 overrides->fUsePLSDstRead = false; |
| 235 out->setKnownSingleComponent(this->coverage()); | |
| 236 } | 237 } |
| 237 | 238 |
| 238 private: | 239 private: |
| 239 void initBatchTracker(const GrPipelineOptimizations& opt) override { | 240 void initBatchTracker(const GrXPOverridesForBatch& overrides) override { |
| 240 // Handle any color overrides | 241 // Handle any color overrides |
| 241 if (!opt.readsColor()) { | 242 if (!overrides.readsColor()) { |
| 242 fGeoData[0].fColor = GrColor_ILLEGAL; | 243 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 243 } | 244 } |
| 244 opt.getOverrideColorIfSet(&fGeoData[0].fColor); | 245 overrides.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 245 | 246 |
| 246 // setup batch properties | 247 // setup batch properties |
| 247 fBatch.fColorIgnored = !opt.readsColor(); | 248 fBatch.fColorIgnored = !overrides.readsColor(); |
| 248 fBatch.fColor = fGeoData[0].fColor; | 249 fBatch.fColor = fGeoData[0].fColor; |
| 249 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); | 250 fBatch.fUsesLocalCoords = overrides.readsLocalCoords(); |
| 250 fBatch.fCoverageIgnored = !opt.readsCoverage(); | 251 fBatch.fCoverageIgnored = !overrides.readsCoverage(); |
| 251 } | 252 } |
| 252 | 253 |
| 253 void onPrepareDraws(Target* target) override { | 254 void onPrepareDraws(Target* target) override { |
| 254 SkAutoTUnref<const GrGeometryProcessor> gp; | 255 SkAutoTUnref<const GrGeometryProcessor> gp; |
| 255 { | 256 { |
| 256 using namespace GrDefaultGeoProcFactory; | 257 using namespace GrDefaultGeoProcFactory; |
| 257 Color color(this->color()); | 258 Color color(this->color()); |
| 258 Coverage coverage(this->coverage()); | 259 Coverage coverage(this->coverage()); |
| 259 if (this->coverageIgnored()) { | 260 if (this->coverageIgnored()) { |
| 260 coverage.fType = Coverage::kNone_Type; | 261 coverage.fType = Coverage::kNone_Type; |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 geometry.fColor = color; | 764 geometry.fColor = color; |
| 764 geometry.fPath = path; | 765 geometry.fPath = path; |
| 765 geometry.fTolerance = srcSpaceTol; | 766 geometry.fTolerance = srcSpaceTol; |
| 766 | 767 |
| 767 viewMatrix.mapRect(&bounds); | 768 viewMatrix.mapRect(&bounds); |
| 768 uint8_t coverage = GrRandomCoverage(random); | 769 uint8_t coverage = GrRandomCoverage(random); |
| 769 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); | 770 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); |
| 770 } | 771 } |
| 771 | 772 |
| 772 #endif | 773 #endif |
| OLD | NEW |