| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrDefaultGeoProcFactory.h" | 8 #include "GrDefaultGeoProcFactory.h" |
| 9 | 9 |
| 10 #include "GrInvariantOutput.h" | 10 #include "GrInvariantOutput.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 const Attribute* inCoverage() const { return fInCoverage; } | 42 const Attribute* inCoverage() const { return fInCoverage; } |
| 43 uint8_t coverage() const { return fCoverage; } | 43 uint8_t coverage() const { return fCoverage; } |
| 44 | 44 |
| 45 void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const
override { | 45 void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const
override { |
| 46 BatchTracker* local = bt->cast<BatchTracker>(); | 46 BatchTracker* local = bt->cast<BatchTracker>(); |
| 47 local->fInputColorType = GetColorInputType(&local->fColor, this->color()
, init, | 47 local->fInputColorType = GetColorInputType(&local->fColor, this->color()
, init, |
| 48 SkToBool(fInColor)); | 48 SkToBool(fInColor)); |
| 49 | 49 |
| 50 bool hasVertexCoverage = SkToBool(fInCoverage) && !init.fCoverageIgnored
; | 50 bool hasVertexCoverage = SkToBool(fInCoverage) && !init.fCoverageIgnored
; |
| 51 bool covIsSolidWhite = !hasVertexCoverage && 0xff == this->coverage(); | 51 bool covIsSolidWhite = !hasVertexCoverage && 0xff == this->coverage(); |
| 52 if (covIsSolidWhite) { | 52 if (init.fCoverageIgnored) { |
| 53 local->fInputCoverageType = kIgnored_GrGPInput; |
| 54 } else if (covIsSolidWhite) { |
| 53 local->fInputCoverageType = kAllOnes_GrGPInput; | 55 local->fInputCoverageType = kAllOnes_GrGPInput; |
| 54 } else if (!hasVertexCoverage) { | |
| 55 local->fInputCoverageType = kUniform_GrGPInput; | |
| 56 local->fCoverage = this->coverage(); | |
| 57 } else if (hasVertexCoverage) { | 56 } else if (hasVertexCoverage) { |
| 58 SkASSERT(fInCoverage); | 57 SkASSERT(fInCoverage); |
| 59 local->fInputCoverageType = kAttribute_GrGPInput; | 58 local->fInputCoverageType = kAttribute_GrGPInput; |
| 60 } else { | 59 } else { |
| 61 local->fInputCoverageType = kIgnored_GrGPInput; | 60 local->fInputCoverageType = kUniform_GrGPInput; |
| 61 local->fCoverage = this->coverage(); |
| 62 } | 62 } |
| 63 | |
| 64 local->fUsesLocalCoords = init.fUsesLocalCoords; | 63 local->fUsesLocalCoords = init.fUsesLocalCoords; |
| 65 } | 64 } |
| 66 | 65 |
| 67 bool onCanMakeEqual(const GrBatchTracker& m, | 66 bool onCanMakeEqual(const GrBatchTracker& m, |
| 68 const GrGeometryProcessor& that, | 67 const GrGeometryProcessor& that, |
| 69 const GrBatchTracker& t) const override { | 68 const GrBatchTracker& t) const override { |
| 70 const BatchTracker& mine = m.cast<BatchTracker>(); | 69 const BatchTracker& mine = m.cast<BatchTracker>(); |
| 71 const BatchTracker& theirs = t.cast<BatchTracker>(); | 70 const BatchTracker& theirs = t.cast<BatchTracker>(); |
| 72 return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords, | 71 return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords, |
| 73 that, theirs.fUsesLocalCoords) && | 72 that, theirs.fUsesLocalCoords) && |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 const SkMatrix& local
Matrix, | 276 const SkMatrix& local
Matrix, |
| 278 bool opaqueVertexColo
rs, | 277 bool opaqueVertexColo
rs, |
| 279 uint8_t coverage) { | 278 uint8_t coverage) { |
| 280 return DefaultGeoProc::Create(gpTypeFlags, | 279 return DefaultGeoProc::Create(gpTypeFlags, |
| 281 color, | 280 color, |
| 282 viewMatrix, | 281 viewMatrix, |
| 283 localMatrix, | 282 localMatrix, |
| 284 opaqueVertexColors, | 283 opaqueVertexColors, |
| 285 coverage); | 284 coverage); |
| 286 } | 285 } |
| OLD | NEW |