| OLD | NEW |
| 1 #include "GrBicubicEffect.h" | 1 #include "GrBicubicEffect.h" |
| 2 | 2 |
| 3 #define DS(x) SkDoubleToScalar(x) | 3 #define DS(x) SkDoubleToScalar(x) |
| 4 | 4 |
| 5 const SkScalar GrBicubicEffect::gMitchellCoefficients[16] = { | 5 const SkScalar GrBicubicEffect::gMitchellCoefficients[16] = { |
| 6 DS( 1.0 / 18.0), DS(-9.0 / 18.0), DS( 15.0 / 18.0), DS( -7.0 / 18.0), | 6 DS( 1.0 / 18.0), DS(-9.0 / 18.0), DS( 15.0 / 18.0), DS( -7.0 / 18.0), |
| 7 DS(16.0 / 18.0), DS( 0.0 / 18.0), DS(-36.0 / 18.0), DS( 21.0 / 18.0), | 7 DS(16.0 / 18.0), DS( 0.0 / 18.0), DS(-36.0 / 18.0), DS( 21.0 / 18.0), |
| 8 DS( 1.0 / 18.0), DS( 9.0 / 18.0), DS( 27.0 / 18.0), DS(-21.0 / 18.0), | 8 DS( 1.0 / 18.0), DS( 9.0 / 18.0), DS( 27.0 / 18.0), DS(-21.0 / 18.0), |
| 9 DS( 0.0 / 18.0), DS( 0.0 / 18.0), DS( -6.0 / 18.0), DS( 7.0 / 18.0), | 9 DS( 0.0 / 18.0), DS( 0.0 / 18.0), DS( -6.0 / 18.0), DS( 7.0 / 18.0), |
| 10 }; | 10 }; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 | 159 |
| 160 void GrBicubicEffect::getConstantColorComponents(GrColor* color, uint32_t* valid
Flags) const { | 160 void GrBicubicEffect::getConstantColorComponents(GrColor* color, uint32_t* valid
Flags) const { |
| 161 // FIXME: Perhaps we can do better. | 161 // FIXME: Perhaps we can do better. |
| 162 *validFlags = 0; | 162 *validFlags = 0; |
| 163 return; | 163 return; |
| 164 } | 164 } |
| 165 | 165 |
| 166 GR_DEFINE_EFFECT_TEST(GrBicubicEffect); | 166 GR_DEFINE_EFFECT_TEST(GrBicubicEffect); |
| 167 | 167 |
| 168 GrEffectRef* GrBicubicEffect::TestCreate(SkRandom* random, | 168 GrEffect* GrBicubicEffect::TestCreate(SkRandom* random, |
| 169 GrContext* context, | 169 GrContext* context, |
| 170 const GrDrawTargetCaps&, | 170 const GrDrawTargetCaps&, |
| 171 GrTexture* textures[]) { | 171 GrTexture* textures[]) { |
| 172 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 172 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
| 173 GrEffectUnitTest::kAlphaTextureIdx; | 173 GrEffectUnitTest::kAlphaTextureIdx; |
| 174 SkScalar coefficients[16]; | 174 SkScalar coefficients[16]; |
| 175 for (int i = 0; i < 16; i++) { | 175 for (int i = 0; i < 16; i++) { |
| 176 coefficients[i] = random->nextSScalar1(); | 176 coefficients[i] = random->nextSScalar1(); |
| 177 } | 177 } |
| 178 return GrBicubicEffect::Create(textures[texIdx], coefficients); | 178 return GrBicubicEffect::Create(textures[texIdx], coefficients); |
| 179 } | 179 } |
| 180 | 180 |
| 181 ////////////////////////////////////////////////////////////////////////////// | 181 ////////////////////////////////////////////////////////////////////////////// |
| (...skipping 21 matching lines...) Expand all Loading... |
| 203 // Use bilerp to handle rotation or fractional translation. | 203 // Use bilerp to handle rotation or fractional translation. |
| 204 *filterMode = GrTextureParams::kBilerp_FilterMode; | 204 *filterMode = GrTextureParams::kBilerp_FilterMode; |
| 205 } | 205 } |
| 206 return false; | 206 return false; |
| 207 } | 207 } |
| 208 // When we use the bicubic filtering effect each sample is read from the tex
ture using | 208 // When we use the bicubic filtering effect each sample is read from the tex
ture using |
| 209 // nearest neighbor sampling. | 209 // nearest neighbor sampling. |
| 210 *filterMode = GrTextureParams::kNone_FilterMode; | 210 *filterMode = GrTextureParams::kNone_FilterMode; |
| 211 return true; | 211 return true; |
| 212 } | 212 } |
| OLD | NEW |