| 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 "GrBatch.h" | 10 #include "GrBatch.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 SkPath fPath; | 217 SkPath fPath; |
| 218 SkScalar fTolerance; | 218 SkScalar fTolerance; |
| 219 SkDEBUGCODE(SkRect fDevBounds;) | 219 SkDEBUGCODE(SkRect fDevBounds;) |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 static GrBatch* Create(const Geometry& geometry, uint8_t coverage, const SkM
atrix& viewMatrix, | 222 static GrBatch* Create(const Geometry& geometry, uint8_t coverage, const SkM
atrix& viewMatrix, |
| 223 bool isHairline) { | 223 bool isHairline) { |
| 224 return SkNEW_ARGS(DefaultPathBatch, (geometry, coverage, viewMatrix, isH
airline)); | 224 return SkNEW_ARGS(DefaultPathBatch, (geometry, coverage, viewMatrix, isH
airline)); |
| 225 } | 225 } |
| 226 | 226 |
| 227 const char* name() const SK_OVERRIDE { return "DefaultPathBatch"; } | 227 const char* name() const override { return "DefaultPathBatch"; } |
| 228 | 228 |
| 229 void getInvariantOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE { | 229 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
| 230 // When this is called on a batch, there is only one geometry bundle | 230 // When this is called on a batch, there is only one geometry bundle |
| 231 out->setKnownFourComponents(fGeoData[0].fColor); | 231 out->setKnownFourComponents(fGeoData[0].fColor); |
| 232 } | 232 } |
| 233 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRID
E { | 233 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 234 out->setKnownSingleComponent(this->coverage()); | 234 out->setKnownSingleComponent(this->coverage()); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE { | 237 void initBatchTracker(const GrPipelineInfo& init) override { |
| 238 // Handle any color overrides | 238 // Handle any color overrides |
| 239 if (init.fColorIgnored) { | 239 if (init.fColorIgnored) { |
| 240 fGeoData[0].fColor = GrColor_ILLEGAL; | 240 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 241 } else if (GrColor_ILLEGAL != init.fOverrideColor) { | 241 } else if (GrColor_ILLEGAL != init.fOverrideColor) { |
| 242 fGeoData[0].fColor = init.fOverrideColor; | 242 fGeoData[0].fColor = init.fOverrideColor; |
| 243 } | 243 } |
| 244 | 244 |
| 245 // setup batch properties | 245 // setup batch properties |
| 246 fBatch.fColorIgnored = init.fColorIgnored; | 246 fBatch.fColorIgnored = init.fColorIgnored; |
| 247 fBatch.fColor = fGeoData[0].fColor; | 247 fBatch.fColor = fGeoData[0].fColor; |
| 248 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; | 248 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; |
| 249 fBatch.fCoverageIgnored = init.fCoverageIgnored; | 249 fBatch.fCoverageIgnored = init.fCoverageIgnored; |
| 250 } | 250 } |
| 251 | 251 |
| 252 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) SK_OVERRIDE { | 252 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
| 253 SkAutoTUnref<const GrGeometryProcessor> gp( | 253 SkAutoTUnref<const GrGeometryProcessor> gp( |
| 254 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi
on_GPType, | 254 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi
on_GPType, |
| 255 this->color(), | 255 this->color(), |
| 256 this->viewMatrix(), | 256 this->viewMatrix(), |
| 257 SkMatrix::I(), | 257 SkMatrix::I(), |
| 258 false, | 258 false, |
| 259 this->coverage())); | 259 this->coverage())); |
| 260 | 260 |
| 261 size_t vertexStride = gp->getVertexStride(); | 261 size_t vertexStride = gp->getVertexStride(); |
| 262 SkASSERT(vertexStride == sizeof(SkPoint)); | 262 SkASSERT(vertexStride == sizeof(SkPoint)); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 private: | 393 private: |
| 394 DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix&
viewMatrix, | 394 DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix&
viewMatrix, |
| 395 bool isHairline) { | 395 bool isHairline) { |
| 396 this->initClassID<DefaultPathBatch>(); | 396 this->initClassID<DefaultPathBatch>(); |
| 397 fBatch.fCoverage = coverage; | 397 fBatch.fCoverage = coverage; |
| 398 fBatch.fIsHairline = isHairline; | 398 fBatch.fIsHairline = isHairline; |
| 399 fBatch.fViewMatrix = viewMatrix; | 399 fBatch.fViewMatrix = viewMatrix; |
| 400 fGeoData.push_back(geometry); | 400 fGeoData.push_back(geometry); |
| 401 } | 401 } |
| 402 | 402 |
| 403 bool onCombineIfPossible(GrBatch* t) SK_OVERRIDE { | 403 bool onCombineIfPossible(GrBatch* t) override { |
| 404 DefaultPathBatch* that = t->cast<DefaultPathBatch>(); | 404 DefaultPathBatch* that = t->cast<DefaultPathBatch>(); |
| 405 | 405 |
| 406 if (this->color() != that->color()) { | 406 if (this->color() != that->color()) { |
| 407 return false; | 407 return false; |
| 408 } | 408 } |
| 409 | 409 |
| 410 if (this->coverage() != that->coverage()) { | 410 if (this->coverage() != that->coverage()) { |
| 411 return false; | 411 return false; |
| 412 } | 412 } |
| 413 | 413 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 | 745 |
| 746 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, | 746 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, |
| 747 GrPipelineBuilder* pipelineBuilder, | 747 GrPipelineBuilder* pipelineBuilder, |
| 748 const SkMatrix& viewMatrix, | 748 const SkMatrix& viewMatrix, |
| 749 const SkPath& path, | 749 const SkPath& path, |
| 750 const SkStrokeRec& stroke) { | 750 const SkStrokeRec& stroke) { |
| 751 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); | 751 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); |
| 752 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); | 752 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); |
| 753 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p
ath, stroke, true); | 753 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p
ath, stroke, true); |
| 754 } | 754 } |
| OLD | NEW |