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 "GrBicubicEffect.h" | 8 #include "GrBicubicEffect.h" |
9 #include "GrInvariantOutput.h" | 9 #include "GrInvariantOutput.h" |
10 #include "gl/builders/GrGLProgramBuilder.h" | 10 #include "gl/builders/GrGLProgramBuilder.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 fDomain == s.fDomain; | 173 fDomain == s.fDomain; |
174 } | 174 } |
175 | 175 |
176 void GrBicubicEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { | 176 void GrBicubicEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { |
177 // FIXME: Perhaps we can do better. | 177 // FIXME: Perhaps we can do better. |
178 inout->mulByUnknownSingleComponent(); | 178 inout->mulByUnknownSingleComponent(); |
179 } | 179 } |
180 | 180 |
181 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrBicubicEffect); | 181 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrBicubicEffect); |
182 | 182 |
183 GrFragmentProcessor* GrBicubicEffect::TestCreate(SkRandom* random, | 183 GrFragmentProcessor* GrBicubicEffect::TestCreate(GrProcessorTestData* d) { |
184 GrContext* context, | 184 int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
: |
185 const GrCaps&, | 185 GrProcessorUnitTest::kAlphaTextureIdx; |
186 GrTexture* textures[]) { | |
187 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : | |
188 GrProcessorUnitTest::kAlphaTextureIdx; | |
189 SkScalar coefficients[16]; | 186 SkScalar coefficients[16]; |
190 for (int i = 0; i < 16; i++) { | 187 for (int i = 0; i < 16; i++) { |
191 coefficients[i] = random->nextSScalar1(); | 188 coefficients[i] = d->fRandom->nextSScalar1(); |
192 } | 189 } |
193 return GrBicubicEffect::Create(textures[texIdx], coefficients); | 190 return GrBicubicEffect::Create(d->fTextures[texIdx], coefficients); |
194 } | 191 } |
195 | 192 |
196 ////////////////////////////////////////////////////////////////////////////// | 193 ////////////////////////////////////////////////////////////////////////////// |
197 | 194 |
198 bool GrBicubicEffect::ShouldUseBicubic(const SkMatrix& matrix, | 195 bool GrBicubicEffect::ShouldUseBicubic(const SkMatrix& matrix, |
199 GrTextureParams::FilterMode* filterMode)
{ | 196 GrTextureParams::FilterMode* filterMode)
{ |
200 if (matrix.isIdentity()) { | 197 if (matrix.isIdentity()) { |
201 *filterMode = GrTextureParams::kNone_FilterMode; | 198 *filterMode = GrTextureParams::kNone_FilterMode; |
202 return false; | 199 return false; |
203 } | 200 } |
(...skipping 14 matching lines...) Expand all Loading... |
218 // Use bilerp to handle rotation or fractional translation. | 215 // Use bilerp to handle rotation or fractional translation. |
219 *filterMode = GrTextureParams::kBilerp_FilterMode; | 216 *filterMode = GrTextureParams::kBilerp_FilterMode; |
220 } | 217 } |
221 return false; | 218 return false; |
222 } | 219 } |
223 // When we use the bicubic filtering effect each sample is read from the tex
ture using | 220 // When we use the bicubic filtering effect each sample is read from the tex
ture using |
224 // nearest neighbor sampling. | 221 // nearest neighbor sampling. |
225 *filterMode = GrTextureParams::kNone_FilterMode; | 222 *filterMode = GrTextureParams::kNone_FilterMode; |
226 return true; | 223 return true; |
227 } | 224 } |
OLD | NEW |