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 #ifndef GrProgramDesc_DEFINED | 8 #ifndef GrProgramDesc_DEFINED |
9 #define GrProgramDesc_DEFINED | 9 #define GrProgramDesc_DEFINED |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 | 50 |
51 static bool Less(const GrProgramDesc& a, const GrProgramDesc& b) { | 51 static bool Less(const GrProgramDesc& a, const GrProgramDesc& b) { |
52 return memcmp(a.asKey(), b.asKey(), a.keyLength() & ~0x3) < 0; | 52 return memcmp(a.asKey(), b.asKey(), a.keyLength() & ~0x3) < 0; |
53 } | 53 } |
54 | 54 |
55 struct KeyHeader { | 55 struct KeyHeader { |
56 uint8_t fFragPosKey; // set by GrGLShaderBuilder i
f there are | 56 uint8_t fFragPosKey; // set by GrGLShaderBuilder i
f there are |
57 // effects that read the frag
ment position. | 57 // effects that read the frag
ment position. |
58 // Otherwise, 0. | 58 // Otherwise, 0. |
59 | 59 uint8_t fSnapVerticesToPixelCenters; |
60 int8_t fColorEffectCnt; | 60 int8_t fColorEffectCnt; |
61 int8_t fCoverageEffectCnt; | 61 int8_t fCoverageEffectCnt; |
62 }; | 62 }; |
| 63 GR_STATIC_ASSERT(sizeof(KeyHeader) == 4); |
63 | 64 |
64 int numColorEffects() const { | 65 int numColorEffects() const { |
65 return this->header().fColorEffectCnt; | 66 return this->header().fColorEffectCnt; |
66 } | 67 } |
67 | 68 |
68 int numCoverageEffects() const { | 69 int numCoverageEffects() const { |
69 return this->header().fCoverageEffectCnt; | 70 return this->header().fCoverageEffectCnt; |
70 } | 71 } |
71 | 72 |
72 int numTotalEffects() const { return this->numColorEffects() + this->numCove
rageEffects(); } | 73 int numTotalEffects() const { return this->numColorEffects() + this->numCove
rageEffects(); } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 }; | 117 }; |
117 | 118 |
118 SkSTArray<kPreAllocSize, uint8_t, true>& key() { return fKey; } | 119 SkSTArray<kPreAllocSize, uint8_t, true>& key() { return fKey; } |
119 const SkSTArray<kPreAllocSize, uint8_t, true>& key() const { return fKey; } | 120 const SkSTArray<kPreAllocSize, uint8_t, true>& key() const { return fKey; } |
120 | 121 |
121 private: | 122 private: |
122 SkSTArray<kPreAllocSize, uint8_t, true> fKey; | 123 SkSTArray<kPreAllocSize, uint8_t, true> fKey; |
123 }; | 124 }; |
124 | 125 |
125 #endif | 126 #endif |
OLD | NEW |