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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 GrColor color() const { return fColor; } | 49 GrColor color() const { return fColor; } |
50 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } | 50 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } |
51 bool hasVertexColor() const { return SkToBool(fInColor); } | 51 bool hasVertexColor() const { return SkToBool(fInColor); } |
52 const SkMatrix& viewMatrix() const { return fViewMatrix; } | 52 const SkMatrix& viewMatrix() const { return fViewMatrix; } |
53 const SkMatrix& localMatrix() const { return fLocalMatrix; } | 53 const SkMatrix& localMatrix() const { return fLocalMatrix; } |
54 bool localCoordsWillBeRead() const { return fLocalCoordsWillBeRead; } | 54 bool localCoordsWillBeRead() const { return fLocalCoordsWillBeRead; } |
55 uint8_t coverage() const { return fCoverage; } | 55 uint8_t coverage() const { return fCoverage; } |
56 bool coverageWillBeIgnored() const { return fCoverageWillBeIgnored; } | 56 bool coverageWillBeIgnored() const { return fCoverageWillBeIgnored; } |
57 bool hasVertexCoverage() const { return SkToBool(fInCoverage); } | 57 bool hasVertexCoverage() const { return SkToBool(fInCoverage); } |
58 | 58 |
59 class GLProcessor : public GrGLSLGeometryProcessor { | 59 class GLSLProcessor : public GrGLSLGeometryProcessor { |
60 public: | 60 public: |
61 GLProcessor() | 61 GLSLProcessor() |
62 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), f
Coverage(0xff) {} | 62 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), f
Coverage(0xff) {} |
63 | 63 |
64 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { | 64 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { |
65 const DefaultGeoProc& gp = args.fGP.cast<DefaultGeoProc>(); | 65 const DefaultGeoProc& gp = args.fGP.cast<DefaultGeoProc>(); |
66 GrGLSLGPBuilder* pb = args.fPB; | 66 GrGLSLGPBuilder* pb = args.fPB; |
67 GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); | 67 GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); |
68 GrGLSLFragmentBuilder* fs = args.fPB->getFragmentShaderBuilder(); | 68 GrGLSLFragmentBuilder* fs = args.fPB->getFragmentShaderBuilder(); |
69 | 69 |
70 // emit attributes | 70 // emit attributes |
71 vsBuilder->emitAttributes(gp); | 71 vsBuilder->emitAttributes(gp); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 SkMatrix fViewMatrix; | 169 SkMatrix fViewMatrix; |
170 GrColor fColor; | 170 GrColor fColor; |
171 uint8_t fCoverage; | 171 uint8_t fCoverage; |
172 UniformHandle fViewMatrixUniform; | 172 UniformHandle fViewMatrixUniform; |
173 UniformHandle fColorUniform; | 173 UniformHandle fColorUniform; |
174 UniformHandle fCoverageUniform; | 174 UniformHandle fCoverageUniform; |
175 | 175 |
176 typedef GrGLSLGeometryProcessor INHERITED; | 176 typedef GrGLSLGeometryProcessor INHERITED; |
177 }; | 177 }; |
178 | 178 |
179 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con
st override { | 179 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override { |
180 GLProcessor::GenKey(*this, caps, b); | 180 GLSLProcessor::GenKey(*this, caps, b); |
181 } | 181 } |
182 | 182 |
183 GrGLSLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override
{ | 183 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri
de { |
184 return new GLProcessor(); | 184 return new GLSLProcessor(); |
185 } | 185 } |
186 | 186 |
187 private: | 187 private: |
188 DefaultGeoProc(uint32_t gpTypeFlags, | 188 DefaultGeoProc(uint32_t gpTypeFlags, |
189 GrColor color, | 189 GrColor color, |
190 const SkMatrix& viewMatrix, | 190 const SkMatrix& viewMatrix, |
191 const SkMatrix& localMatrix, | 191 const SkMatrix& localMatrix, |
192 uint8_t coverage, | 192 uint8_t coverage, |
193 bool localCoordsWillBeRead, | 193 bool localCoordsWillBeRead, |
194 bool coverageWillBeIgnored) | 194 bool coverageWillBeIgnored) |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 } | 312 } |
313 | 313 |
314 if (localCoords.hasLocalMatrix()) { | 314 if (localCoords.hasLocalMatrix()) { |
315 invert.preConcat(*localCoords.fMatrix); | 315 invert.preConcat(*localCoords.fMatrix); |
316 } | 316 } |
317 } | 317 } |
318 | 318 |
319 LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert); | 319 LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert); |
320 return Create(color, coverage, inverted, SkMatrix::I()); | 320 return Create(color, coverage, inverted, SkMatrix::I()); |
321 } | 321 } |
OLD | NEW |