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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 } | 110 } |
111 this->setWillNotUseInputColor(); | 111 this->setWillNotUseInputColor(); |
112 } | 112 } |
113 | 113 |
114 GrBicubicEffect::GrBicubicEffect(GrTexture* texture, | 114 GrBicubicEffect::GrBicubicEffect(GrTexture* texture, |
115 const SkScalar coefficients[16], | 115 const SkScalar coefficients[16], |
116 const SkMatrix &matrix, | 116 const SkMatrix &matrix, |
117 const GrTextureParams ¶ms, | 117 const GrTextureParams ¶ms, |
118 GrCoordSet coordSet) | 118 GrCoordSet coordSet) |
119 : INHERITED(texture, MakeDivByTextureWHMatrix(texture), params, coordSet) { | 119 : INHERITED(texture, matrix, params, coordSet) { |
120 for (int y = 0; y < 4; y++) { | 120 for (int y = 0; y < 4; y++) { |
121 for (int x = 0; x < 4; x++) { | 121 for (int x = 0; x < 4; x++) { |
122 // Convert from row-major scalars to column-major floats. | 122 // Convert from row-major scalars to column-major floats. |
123 fCoefficients[x * 4 + y] = SkScalarToFloat(coefficients[y * 4 + x]); | 123 fCoefficients[x * 4 + y] = SkScalarToFloat(coefficients[y * 4 + x]); |
124 } | 124 } |
125 } | 125 } |
126 this->setWillNotUseInputColor(); | 126 this->setWillNotUseInputColor(); |
127 } | 127 } |
128 | 128 |
129 GrBicubicEffect::~GrBicubicEffect() { | 129 GrBicubicEffect::~GrBicubicEffect() { |
(...skipping 22 matching lines...) Expand all Loading... |
152 const GrDrawTargetCaps&, | 152 const GrDrawTargetCaps&, |
153 GrTexture* textures[]) { | 153 GrTexture* textures[]) { |
154 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 154 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
155 GrEffectUnitTest::kAlphaTextureIdx; | 155 GrEffectUnitTest::kAlphaTextureIdx; |
156 SkScalar coefficients[16]; | 156 SkScalar coefficients[16]; |
157 for (int i = 0; i < 16; i++) { | 157 for (int i = 0; i < 16; i++) { |
158 coefficients[i] = random->nextSScalar1(); | 158 coefficients[i] = random->nextSScalar1(); |
159 } | 159 } |
160 return GrBicubicEffect::Create(textures[texIdx], coefficients); | 160 return GrBicubicEffect::Create(textures[texIdx], coefficients); |
161 } | 161 } |
OLD | NEW |