OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 // This is a GPU-backend specific test. It relies on static intializers to work | 9 // This is a GPU-backend specific test. It relies on static intializers to work |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 int currAttribIndex = GrDrawState::kAttribIndexCount; | 127 int currAttribIndex = GrDrawState::kAttribIndexCount; |
128 int attribIndices[2]; | 128 int attribIndices[2]; |
129 for (int s = 0; s < maxStages; ++s) { | 129 for (int s = 0; s < maxStages; ++s) { |
130 // enable the stage? | 130 // enable the stage? |
131 if (random.nextBool()) { | 131 if (random.nextBool()) { |
132 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2
.get()}; | 132 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2
.get()}; |
133 SkAutoTUnref<const GrEffectRef> effect(GrEffectTestFactory::Crea
teStage( | 133 SkAutoTUnref<const GrEffectRef> effect(GrEffectTestFactory::Crea
teStage( |
134
&random, | 134
&random, |
135
this->getContext(), | 135
this->getContext(), |
136
dummyTextures)); | 136
dummyTextures)); |
137 for (int i = 0; i < effect.get()->get()->numVertexAttribs(); ++i
) { | 137 int numAttribs = (*effect)->numVertexAttribs(); |
| 138 |
| 139 // If adding this effect would cause to exceed the max attrib co
unt then generate a |
| 140 // new random effect. The explanation for why this check is corr
ect is a bit |
| 141 // convoluted and this code will be removed soon. |
| 142 if (currAttribIndex + numAttribs > GrDrawState::kCoverageOverrid
eAttribIndexValue) { |
| 143 --s; |
| 144 continue; |
| 145 } |
| 146 for (int i = 0; i < numAttribs; ++i) { |
138 attribIndices[i] = currAttribIndex++; | 147 attribIndices[i] = currAttribIndex++; |
139 } | 148 } |
140 stages[s].setEffect(effect.get(), attribIndices[0], attribIndice
s[1]); | 149 stages[s].setEffect(effect.get(), attribIndices[0], attribIndice
s[1]); |
141 } | 150 } |
142 } | 151 } |
143 pdesc.setRandom(&random, this, stages); | 152 pdesc.setRandom(&random, this, stages); |
144 | 153 |
145 const GrEffectStage* stagePtrs[GrDrawState::kNumStages]; | 154 const GrEffectStage* stagePtrs[GrDrawState::kNumStages]; |
146 for (int s = 0; s < GrDrawState::kNumStages; ++s) { | 155 for (int s = 0; s < GrDrawState::kNumStages; ++s) { |
147 stagePtrs[s] = &stages[s]; | 156 stagePtrs[s] = &stages[s]; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 SkMagnifierImageFilter mag(SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar
1); | 201 SkMagnifierImageFilter mag(SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar
1); |
193 GrConfigConversionEffect::Create(NULL, | 202 GrConfigConversionEffect::Create(NULL, |
194 false, | 203 false, |
195 GrConfigConversionEffect::kNone_PMConversio
n, | 204 GrConfigConversionEffect::kNone_PMConversio
n, |
196 SkMatrix::I()); | 205 SkMatrix::I()); |
197 SkScalar matrix[20]; | 206 SkScalar matrix[20]; |
198 SkColorMatrixFilter cmf(matrix); | 207 SkColorMatrixFilter cmf(matrix); |
199 } | 208 } |
200 | 209 |
201 #endif | 210 #endif |
OLD | NEW |