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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 /** | 72 /** |
73 * Create a Mitchell filter effect with a texture matrix and a domain. | 73 * Create a Mitchell filter effect with a texture matrix and a domain. |
74 */ | 74 */ |
75 static GrEffectRef* Create(GrTexture* tex, const SkMatrix& matrix, const SkR
ect& domain) { | 75 static GrEffectRef* Create(GrTexture* tex, const SkMatrix& matrix, const SkR
ect& domain) { |
76 AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, gMitchellCoeffi
cients, matrix, | 76 AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, gMitchellCoeffi
cients, matrix, |
77 domain))); | 77 domain))); |
78 return CreateEffectRef(effect); | 78 return CreateEffectRef(effect); |
79 } | 79 } |
80 | 80 |
| 81 /** |
| 82 * Determines whether the bicubic effect should be used based on the transfo
rmation from the |
| 83 * local coords to the device. Returns true if the bicubic effect should be
used. filterMode |
| 84 * is set to appropriate filtering mode to use regardless of the return resu
lt (e.g. when this |
| 85 * returns false it may indicate that the best fallback is to use kMipMap, k
Bilerp, or |
| 86 * kNearest). |
| 87 */ |
| 88 static bool ShouldUseBicubic(const SkMatrix& localCoordsToDevice, |
| 89 GrTextureParams::FilterMode* filterMode); |
| 90 |
81 private: | 91 private: |
82 GrBicubicEffect(GrTexture*, const SkScalar coefficients[16], | 92 GrBicubicEffect(GrTexture*, const SkScalar coefficients[16], |
83 const SkMatrix &matrix, const SkShader::TileMode tileModes[2
]); | 93 const SkMatrix &matrix, const SkShader::TileMode tileModes[2
]); |
84 GrBicubicEffect(GrTexture*, const SkScalar coefficients[16], | 94 GrBicubicEffect(GrTexture*, const SkScalar coefficients[16], |
85 const SkMatrix &matrix, const SkRect& domain); | 95 const SkMatrix &matrix, const SkRect& domain); |
86 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; | 96 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; |
87 | 97 |
88 float fCoefficients[16]; | 98 float fCoefficients[16]; |
89 GrTextureDomain fDomain; | 99 GrTextureDomain fDomain; |
90 | 100 |
91 GR_DECLARE_EFFECT_TEST; | 101 GR_DECLARE_EFFECT_TEST; |
92 | 102 |
93 static const SkScalar gMitchellCoefficients[16]; | 103 static const SkScalar gMitchellCoefficients[16]; |
94 | 104 |
95 typedef GrSingleTextureEffect INHERITED; | 105 typedef GrSingleTextureEffect INHERITED; |
96 }; | 106 }; |
97 | 107 |
98 #endif | 108 #endif |
OLD | NEW |