| 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 "gl/builders/GrGLProgramBuilder.h" | 8 #include "gl/builders/GrGLProgramBuilder.h" |
| 9 #include "GrBicubicEffect.h" | 9 #include "GrBicubicEffect.h" |
| 10 | 10 #include "GrInvariantOutput.h" |
| 11 | 11 |
| 12 #define DS(x) SkDoubleToScalar(x) | 12 #define DS(x) SkDoubleToScalar(x) |
| 13 | 13 |
| 14 const SkScalar GrBicubicEffect::gMitchellCoefficients[16] = { | 14 const SkScalar GrBicubicEffect::gMitchellCoefficients[16] = { |
| 15 DS( 1.0 / 18.0), DS(-9.0 / 18.0), DS( 15.0 / 18.0), DS( -7.0 / 18.0), | 15 DS( 1.0 / 18.0), DS(-9.0 / 18.0), DS( 15.0 / 18.0), DS( -7.0 / 18.0), |
| 16 DS(16.0 / 18.0), DS( 0.0 / 18.0), DS(-36.0 / 18.0), DS( 21.0 / 18.0), | 16 DS(16.0 / 18.0), DS( 0.0 / 18.0), DS(-36.0 / 18.0), DS( 21.0 / 18.0), |
| 17 DS( 1.0 / 18.0), DS( 9.0 / 18.0), DS( 27.0 / 18.0), DS(-21.0 / 18.0), | 17 DS( 1.0 / 18.0), DS( 9.0 / 18.0), DS( 27.0 / 18.0), DS(-21.0 / 18.0), |
| 18 DS( 0.0 / 18.0), DS( 0.0 / 18.0), DS( -6.0 / 18.0), DS( 7.0 / 18.0), | 18 DS( 0.0 / 18.0), DS( 0.0 / 18.0), DS( -6.0 / 18.0), DS( 7.0 / 18.0), |
| 19 }; | 19 }; |
| 20 | 20 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 const GrBackendFragmentProcessorFactory& GrBicubicEffect::getFactory() const { | 161 const GrBackendFragmentProcessorFactory& GrBicubicEffect::getFactory() const { |
| 162 return GrTBackendFragmentProcessorFactory<GrBicubicEffect>::getInstance(); | 162 return GrTBackendFragmentProcessorFactory<GrBicubicEffect>::getInstance(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 bool GrBicubicEffect::onIsEqual(const GrFragmentProcessor& sBase) const { | 165 bool GrBicubicEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
| 166 const GrBicubicEffect& s = sBase.cast<GrBicubicEffect>(); | 166 const GrBicubicEffect& s = sBase.cast<GrBicubicEffect>(); |
| 167 return !memcmp(fCoefficients, s.coefficients(), 16) && | 167 return !memcmp(fCoefficients, s.coefficients(), 16) && |
| 168 fDomain == s.fDomain; | 168 fDomain == s.fDomain; |
| 169 } | 169 } |
| 170 | 170 |
| 171 void GrBicubicEffect::onComputeInvariantOutput(InvariantOutput* inout) const { | 171 void GrBicubicEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { |
| 172 // FIXME: Perhaps we can do better. | 172 // FIXME: Perhaps we can do better. |
| 173 inout->mulByUnknownAlpha(); | 173 inout->mulByUnknownAlpha(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrBicubicEffect); | 176 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrBicubicEffect); |
| 177 | 177 |
| 178 GrFragmentProcessor* GrBicubicEffect::TestCreate(SkRandom* random, | 178 GrFragmentProcessor* GrBicubicEffect::TestCreate(SkRandom* random, |
| 179 GrContext* context, | 179 GrContext* context, |
| 180 const GrDrawTargetCaps&, | 180 const GrDrawTargetCaps&, |
| 181 GrTexture* textures[]) { | 181 GrTexture* textures[]) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // Use bilerp to handle rotation or fractional translation. | 213 // Use bilerp to handle rotation or fractional translation. |
| 214 *filterMode = GrTextureParams::kBilerp_FilterMode; | 214 *filterMode = GrTextureParams::kBilerp_FilterMode; |
| 215 } | 215 } |
| 216 return false; | 216 return false; |
| 217 } | 217 } |
| 218 // When we use the bicubic filtering effect each sample is read from the tex
ture using | 218 // When we use the bicubic filtering effect each sample is read from the tex
ture using |
| 219 // nearest neighbor sampling. | 219 // nearest neighbor sampling. |
| 220 *filterMode = GrTextureParams::kNone_FilterMode; | 220 *filterMode = GrTextureParams::kNone_FilterMode; |
| 221 return true; | 221 return true; |
| 222 } | 222 } |
| OLD | NEW |