| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrBicubicTextureEffect_DEFINED | 8 #ifndef GrBicubicTextureEffect_DEFINED |
| 9 #define GrBicubicTextureEffect_DEFINED | 9 #define GrBicubicTextureEffect_DEFINED |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 const GrTextureDomain& domain() const { return fDomain; } | 35 const GrTextureDomain& domain() const { return fDomain; } |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * Create a simple filter effect with custom bicubic coefficients and option
al domain. | 38 * Create a simple filter effect with custom bicubic coefficients and option
al domain. |
| 39 */ | 39 */ |
| 40 static GrEffect* Create(GrTexture* tex, const SkScalar coefficients[16], | 40 static GrEffect* Create(GrTexture* tex, const SkScalar coefficients[16], |
| 41 const SkRect* domain = NULL) { | 41 const SkRect* domain = NULL) { |
| 42 if (NULL == domain) { | 42 if (NULL == domain) { |
| 43 static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_Ti
leMode, | 43 static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_Ti
leMode, |
| 44 SkShader::kClamp_Ti
leMode }; | 44 SkShader::kClamp_Ti
leMode }; |
| 45 return Create(tex, coefficients, MakeDivByTextureWHMatrix(tex), kTil
eModes); | 45 return Create(tex, coefficients, GrCoordTransform::MakeDivByTextureW
HMatrix(tex), |
| 46 kTileModes); |
| 46 } else { | 47 } else { |
| 47 return SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, | 48 return SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, |
| 48 MakeDivByTextureWHMatrix(tex), *
domain)); | 49 GrCoordTransform::MakeDivByTextu
reWHMatrix(tex), |
| 50 *domain)); |
| 49 } | 51 } |
| 50 } | 52 } |
| 51 | 53 |
| 52 /** | 54 /** |
| 53 * Create a Mitchell filter effect with specified texture matrix and x/y til
e modes. | 55 * Create a Mitchell filter effect with specified texture matrix and x/y til
e modes. |
| 54 */ | 56 */ |
| 55 static GrEffect* Create(GrTexture* tex, const SkMatrix& matrix, | 57 static GrEffect* Create(GrTexture* tex, const SkMatrix& matrix, |
| 56 SkShader::TileMode tileModes[2]) { | 58 SkShader::TileMode tileModes[2]) { |
| 57 return Create(tex, gMitchellCoefficients, matrix, tileModes); | 59 return Create(tex, gMitchellCoefficients, matrix, tileModes); |
| 58 } | 60 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 GrTextureDomain fDomain; | 96 GrTextureDomain fDomain; |
| 95 | 97 |
| 96 GR_DECLARE_EFFECT_TEST; | 98 GR_DECLARE_EFFECT_TEST; |
| 97 | 99 |
| 98 static const SkScalar gMitchellCoefficients[16]; | 100 static const SkScalar gMitchellCoefficients[16]; |
| 99 | 101 |
| 100 typedef GrSingleTextureEffect INHERITED; | 102 typedef GrSingleTextureEffect INHERITED; |
| 101 }; | 103 }; |
| 102 | 104 |
| 103 #endif | 105 #endif |
| OLD | NEW |