| 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 20 matching lines...) Expand all Loading... |
| 31 localMatrix, | 31 localMatrix, |
| 32 coverage)); | 32 coverage)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 const char* name() const override { return "DefaultGeometryProcessor"; } | 35 const char* name() const override { return "DefaultGeometryProcessor"; } |
| 36 | 36 |
| 37 const Attribute* inPosition() const { return fInPosition; } | 37 const Attribute* inPosition() const { return fInPosition; } |
| 38 const Attribute* inColor() const { return fInColor; } | 38 const Attribute* inColor() const { return fInColor; } |
| 39 const Attribute* inLocalCoords() const { return fInLocalCoords; } | 39 const Attribute* inLocalCoords() const { return fInLocalCoords; } |
| 40 const Attribute* inCoverage() const { return fInCoverage; } | 40 const Attribute* inCoverage() const { return fInCoverage; } |
| 41 GrColor color() const { return fColor; } |
| 41 uint8_t coverage() const { return fCoverage; } | 42 uint8_t coverage() const { return fCoverage; } |
| 42 | 43 |
| 43 void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const
override { | 44 void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const
override { |
| 44 BatchTracker* local = bt->cast<BatchTracker>(); | 45 BatchTracker* local = bt->cast<BatchTracker>(); |
| 45 local->fInputColorType = GetColorInputType(&local->fColor, this->color()
, init, | 46 local->fInputColorType = GetColorInputType(&local->fColor, this->color()
, init, |
| 46 SkToBool(fInColor)); | 47 SkToBool(fInColor)); |
| 47 | 48 |
| 48 bool hasVertexCoverage = SkToBool(fInCoverage) && !init.fCoverageIgnored
; | 49 bool hasVertexCoverage = SkToBool(fInCoverage) && !init.fCoverageIgnored
; |
| 49 bool covIsSolidWhite = !hasVertexCoverage && 0xff == this->coverage(); | 50 bool covIsSolidWhite = !hasVertexCoverage && 0xff == this->coverage(); |
| 50 if (init.fCoverageIgnored) { | 51 if (init.fCoverageIgnored) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 const GrGLSLCaps&) const ov
erride { | 162 const GrGLSLCaps&) const ov
erride { |
| 162 return SkNEW_ARGS(GLProcessor, (*this, bt)); | 163 return SkNEW_ARGS(GLProcessor, (*this, bt)); |
| 163 } | 164 } |
| 164 | 165 |
| 165 private: | 166 private: |
| 166 DefaultGeoProc(uint32_t gpTypeFlags, | 167 DefaultGeoProc(uint32_t gpTypeFlags, |
| 167 GrColor color, | 168 GrColor color, |
| 168 const SkMatrix& viewMatrix, | 169 const SkMatrix& viewMatrix, |
| 169 const SkMatrix& localMatrix, | 170 const SkMatrix& localMatrix, |
| 170 uint8_t coverage) | 171 uint8_t coverage) |
| 171 : INHERITED(color, viewMatrix, localMatrix) | 172 : INHERITED(viewMatrix, localMatrix) |
| 172 , fInPosition(NULL) | 173 , fInPosition(NULL) |
| 173 , fInColor(NULL) | 174 , fInColor(NULL) |
| 174 , fInLocalCoords(NULL) | 175 , fInLocalCoords(NULL) |
| 175 , fInCoverage(NULL) | 176 , fInCoverage(NULL) |
| 177 , fColor(color) |
| 176 , fCoverage(coverage) | 178 , fCoverage(coverage) |
| 177 , fFlags(gpTypeFlags) { | 179 , fFlags(gpTypeFlags) { |
| 178 this->initClassID<DefaultGeoProc>(); | 180 this->initClassID<DefaultGeoProc>(); |
| 179 bool hasColor = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kColor_G
PType); | 181 bool hasColor = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kColor_G
PType); |
| 180 bool hasLocalCoord = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kLo
calCoord_GPType); | 182 bool hasLocalCoord = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kLo
calCoord_GPType); |
| 181 bool hasCoverage = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kCove
rage_GPType); | 183 bool hasCoverage = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kCove
rage_GPType); |
| 182 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType)); | 184 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType)); |
| 183 if (hasColor) { | 185 if (hasColor) { |
| 184 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVer
texAttribType)); | 186 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVer
texAttribType)); |
| 185 } | 187 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 199 GrGPInput fInputCoverageType; | 201 GrGPInput fInputCoverageType; |
| 200 GrColor fColor; | 202 GrColor fColor; |
| 201 GrColor fCoverage; | 203 GrColor fCoverage; |
| 202 bool fUsesLocalCoords; | 204 bool fUsesLocalCoords; |
| 203 }; | 205 }; |
| 204 | 206 |
| 205 const Attribute* fInPosition; | 207 const Attribute* fInPosition; |
| 206 const Attribute* fInColor; | 208 const Attribute* fInColor; |
| 207 const Attribute* fInLocalCoords; | 209 const Attribute* fInLocalCoords; |
| 208 const Attribute* fInCoverage; | 210 const Attribute* fInCoverage; |
| 211 GrColor fColor; |
| 209 uint8_t fCoverage; | 212 uint8_t fCoverage; |
| 210 uint32_t fFlags; | 213 uint32_t fFlags; |
| 211 | 214 |
| 212 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 215 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 213 | 216 |
| 214 typedef GrGeometryProcessor INHERITED; | 217 typedef GrGeometryProcessor INHERITED; |
| 215 }; | 218 }; |
| 216 | 219 |
| 217 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DefaultGeoProc); | 220 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DefaultGeoProc); |
| 218 | 221 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 242 GrColor color, | 245 GrColor color, |
| 243 const SkMatrix& viewM
atrix, | 246 const SkMatrix& viewM
atrix, |
| 244 const SkMatrix& local
Matrix, | 247 const SkMatrix& local
Matrix, |
| 245 uint8_t coverage) { | 248 uint8_t coverage) { |
| 246 return DefaultGeoProc::Create(gpTypeFlags, | 249 return DefaultGeoProc::Create(gpTypeFlags, |
| 247 color, | 250 color, |
| 248 viewMatrix, | 251 viewMatrix, |
| 249 localMatrix, | 252 localMatrix, |
| 250 coverage); | 253 coverage); |
| 251 } | 254 } |
| OLD | NEW |