| 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 "GrDrawState.h" | 10 #include "GrDrawState.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 kFloat_GrVertexAttr
ibType)); | 121 kFloat_GrVertexAttr
ibType)); |
| 122 this->setHasVertexCoverage(); | 122 this->setHasVertexCoverage(); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { | 126 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { |
| 127 const DefaultGeoProc& gp = other.cast<DefaultGeoProc>(); | 127 const DefaultGeoProc& gp = other.cast<DefaultGeoProc>(); |
| 128 return gp.fFlags == this->fFlags; | 128 return gp.fFlags == this->fFlags; |
| 129 } | 129 } |
| 130 | 130 |
| 131 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE { | 131 virtual void onGetOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRI
DE { |
| 132 if (fInCoverage) { | 132 if (fInCoverage) { |
| 133 inout->mulByUnknownAlpha(); | 133 out->setUnknownSingleComponent(); |
| 134 } else { | 134 } else { |
| 135 inout->mulByKnownAlpha(255); | 135 // uniform coverage |
| 136 out->setKnownSingleComponent(this->coverage()); |
| 136 } | 137 } |
| 137 } | 138 } |
| 138 | 139 |
| 139 const GrAttribute* fInPosition; | 140 const GrAttribute* fInPosition; |
| 140 const GrAttribute* fInColor; | 141 const GrAttribute* fInColor; |
| 141 const GrAttribute* fInLocalCoords; | 142 const GrAttribute* fInLocalCoords; |
| 142 const GrAttribute* fInCoverage; | 143 const GrAttribute* fInCoverage; |
| 143 uint32_t fFlags; | 144 uint32_t fFlags; |
| 144 | 145 |
| 145 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 146 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 164 flags |= GrDefaultGeoProcFactory::kLocalCoord_GPType; | 165 flags |= GrDefaultGeoProcFactory::kLocalCoord_GPType; |
| 165 } | 166 } |
| 166 | 167 |
| 167 return DefaultGeoProc::Create(GrRandomColor(random), GrRandomCoverage(random
), flags); | 168 return DefaultGeoProc::Create(GrRandomColor(random), GrRandomCoverage(random
), flags); |
| 168 } | 169 } |
| 169 | 170 |
| 170 const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(GrColor color, uint32
_t gpTypeFlags, | 171 const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(GrColor color, uint32
_t gpTypeFlags, |
| 171 uint8_t coverage) { | 172 uint8_t coverage) { |
| 172 return DefaultGeoProc::Create(color, coverage, gpTypeFlags); | 173 return DefaultGeoProc::Create(color, coverage, gpTypeFlags); |
| 173 } | 174 } |
| OLD | NEW |