OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrBezierEffect.h" | 8 #include "GrBezierEffect.h" |
9 | 9 |
10 #include "gl/GrGLProcessor.h" | 10 #include "gl/GrGLProcessor.h" |
11 #include "gl/GrGLSL.h" | 11 #include "gl/GrGLSL.h" |
12 #include "gl/GrGLGeometryProcessor.h" | 12 #include "gl/GrGLGeometryProcessor.h" |
13 #include "gl/builders/GrGLProgramBuilder.h" | 13 #include "gl/builders/GrGLProgramBuilder.h" |
14 | 14 |
15 struct ConicBatchTracker { | 15 struct ConicBatchTracker { |
16 GrGPInput fInputColorType; | 16 GrGPInput fInputColorType; |
17 GrColor fColor; | 17 GrColor fColor; |
18 uint8_t fCoverageScale; | 18 uint8_t fCoverageScale; |
19 bool fUsesLocalCoords; | 19 bool fUsesLocalCoords; |
20 }; | 20 }; |
21 | 21 |
22 class GrGLConicEffect : public GrGLGeometryProcessor { | 22 class GrGLConicEffect : public GrGLGeometryProcessor { |
23 public: | 23 public: |
24 GrGLConicEffect(const GrGeometryProcessor&, | 24 GrGLConicEffect(const GrGeometryProcessor&, |
25 const GrBatchTracker&); | 25 const GrBatchTracker&); |
26 | 26 |
27 void onEmitCode(EmitArgs&, GrGPArgs*) SK_OVERRIDE; | 27 void onEmitCode(EmitArgs&, GrGPArgs*) override; |
28 | 28 |
29 static inline void GenKey(const GrGeometryProcessor&, | 29 static inline void GenKey(const GrGeometryProcessor&, |
30 const GrBatchTracker&, | 30 const GrBatchTracker&, |
31 const GrGLCaps&, | 31 const GrGLCaps&, |
32 GrProcessorKeyBuilder*); | 32 GrProcessorKeyBuilder*); |
33 | 33 |
34 virtual void setData(const GrGLProgramDataManager& pdman, | 34 virtual void setData(const GrGLProgramDataManager& pdman, |
35 const GrPrimitiveProcessor& primProc, | 35 const GrPrimitiveProcessor& primProc, |
36 const GrBatchTracker& bt) SK_OVERRIDE { | 36 const GrBatchTracker& bt) override { |
37 this->setUniformViewMatrix(pdman, primProc.viewMatrix()); | 37 this->setUniformViewMatrix(pdman, primProc.viewMatrix()); |
38 | 38 |
39 const ConicBatchTracker& local = bt.cast<ConicBatchTracker>(); | 39 const ConicBatchTracker& local = bt.cast<ConicBatchTracker>(); |
40 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColo
r) { | 40 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColo
r) { |
41 GrGLfloat c[4]; | 41 GrGLfloat c[4]; |
42 GrColorToRGBAFloat(local.fColor, c); | 42 GrColorToRGBAFloat(local.fColor, c); |
43 pdman.set4fv(fColorUniform, 1, c); | 43 pdman.set4fv(fColorUniform, 1, c); |
44 fColor = local.fColor; | 44 fColor = local.fColor; |
45 } | 45 } |
46 if (0xff != local.fCoverageScale && fCoverageScale != local.fCoverageSca
le) { | 46 if (0xff != local.fCoverageScale && fCoverageScale != local.fCoverageSca
le) { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 GrColor fColor; | 252 GrColor fColor; |
253 uint8_t fCoverageScale; | 253 uint8_t fCoverageScale; |
254 bool fUsesLocalCoords; | 254 bool fUsesLocalCoords; |
255 }; | 255 }; |
256 | 256 |
257 class GrGLQuadEffect : public GrGLGeometryProcessor { | 257 class GrGLQuadEffect : public GrGLGeometryProcessor { |
258 public: | 258 public: |
259 GrGLQuadEffect(const GrGeometryProcessor&, | 259 GrGLQuadEffect(const GrGeometryProcessor&, |
260 const GrBatchTracker&); | 260 const GrBatchTracker&); |
261 | 261 |
262 void onEmitCode(EmitArgs&, GrGPArgs*) SK_OVERRIDE; | 262 void onEmitCode(EmitArgs&, GrGPArgs*) override; |
263 | 263 |
264 static inline void GenKey(const GrGeometryProcessor&, | 264 static inline void GenKey(const GrGeometryProcessor&, |
265 const GrBatchTracker&, | 265 const GrBatchTracker&, |
266 const GrGLCaps&, | 266 const GrGLCaps&, |
267 GrProcessorKeyBuilder*); | 267 GrProcessorKeyBuilder*); |
268 | 268 |
269 virtual void setData(const GrGLProgramDataManager& pdman, | 269 virtual void setData(const GrGLProgramDataManager& pdman, |
270 const GrPrimitiveProcessor& primProc, | 270 const GrPrimitiveProcessor& primProc, |
271 const GrBatchTracker& bt) SK_OVERRIDE { | 271 const GrBatchTracker& bt) override { |
272 this->setUniformViewMatrix(pdman, primProc.viewMatrix()); | 272 this->setUniformViewMatrix(pdman, primProc.viewMatrix()); |
273 | 273 |
274 const QuadBatchTracker& local = bt.cast<QuadBatchTracker>(); | 274 const QuadBatchTracker& local = bt.cast<QuadBatchTracker>(); |
275 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColo
r) { | 275 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColo
r) { |
276 GrGLfloat c[4]; | 276 GrGLfloat c[4]; |
277 GrColorToRGBAFloat(local.fColor, c); | 277 GrColorToRGBAFloat(local.fColor, c); |
278 pdman.set4fv(fColorUniform, 1, c); | 278 pdman.set4fv(fColorUniform, 1, c); |
279 fColor = local.fColor; | 279 fColor = local.fColor; |
280 } | 280 } |
281 if (0xff != local.fCoverageScale && local.fCoverageScale != fCoverageSca
le) { | 281 if (0xff != local.fCoverageScale && local.fCoverageScale != fCoverageSca
le) { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 GrGPInput fInputColorType; | 473 GrGPInput fInputColorType; |
474 GrColor fColor; | 474 GrColor fColor; |
475 bool fUsesLocalCoords; | 475 bool fUsesLocalCoords; |
476 }; | 476 }; |
477 | 477 |
478 class GrGLCubicEffect : public GrGLGeometryProcessor { | 478 class GrGLCubicEffect : public GrGLGeometryProcessor { |
479 public: | 479 public: |
480 GrGLCubicEffect(const GrGeometryProcessor&, | 480 GrGLCubicEffect(const GrGeometryProcessor&, |
481 const GrBatchTracker&); | 481 const GrBatchTracker&); |
482 | 482 |
483 void onEmitCode(EmitArgs&, GrGPArgs*) SK_OVERRIDE; | 483 void onEmitCode(EmitArgs&, GrGPArgs*) override; |
484 | 484 |
485 static inline void GenKey(const GrGeometryProcessor&, | 485 static inline void GenKey(const GrGeometryProcessor&, |
486 const GrBatchTracker&, | 486 const GrBatchTracker&, |
487 const GrGLCaps&, | 487 const GrGLCaps&, |
488 GrProcessorKeyBuilder*); | 488 GrProcessorKeyBuilder*); |
489 | 489 |
490 virtual void setData(const GrGLProgramDataManager& pdman, | 490 virtual void setData(const GrGLProgramDataManager& pdman, |
491 const GrPrimitiveProcessor& primProc, | 491 const GrPrimitiveProcessor& primProc, |
492 const GrBatchTracker& bt) SK_OVERRIDE { | 492 const GrBatchTracker& bt) override { |
493 this->setUniformViewMatrix(pdman, primProc.viewMatrix()); | 493 this->setUniformViewMatrix(pdman, primProc.viewMatrix()); |
494 | 494 |
495 const CubicBatchTracker& local = bt.cast<CubicBatchTracker>(); | 495 const CubicBatchTracker& local = bt.cast<CubicBatchTracker>(); |
496 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColo
r) { | 496 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColo
r) { |
497 GrGLfloat c[4]; | 497 GrGLfloat c[4]; |
498 GrColorToRGBAFloat(local.fColor, c); | 498 GrColorToRGBAFloat(local.fColor, c); |
499 pdman.set4fv(fColorUniform, 1, c); | 499 pdman.set4fv(fColorUniform, 1, c); |
500 fColor = local.fColor; | 500 fColor = local.fColor; |
501 } | 501 } |
502 } | 502 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 GrGeometryProcessor* gp; | 696 GrGeometryProcessor* gp; |
697 do { | 697 do { |
698 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 698 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
699 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); | 699 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); |
700 gp = GrCubicEffect::Create(GrRandomColor(random), | 700 gp = GrCubicEffect::Create(GrRandomColor(random), |
701 GrProcessorUnitTest::TestMatrix(random), edge
Type, caps); | 701 GrProcessorUnitTest::TestMatrix(random), edge
Type, caps); |
702 } while (NULL == gp); | 702 } while (NULL == gp); |
703 return gp; | 703 return gp; |
704 } | 704 } |
705 | 705 |
OLD | NEW |