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 "GrBicubicEffect.h" | 8 #include "GrBicubicEffect.h" |
9 #include "GrInvariantOutput.h" | 9 #include "GrInvariantOutput.h" |
10 #include "glsl/GrGLSLColorSpaceXformHelper.h" | 10 #include "glsl/GrGLSLColorSpaceXformHelper.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 const GrProcessor& processor) { | 125 const GrProcessor& processor) { |
126 const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>(); | 126 const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>(); |
127 const GrTexture& texture = *processor.texture(0); | 127 const GrTexture& texture = *processor.texture(0); |
128 float imageIncrement[2]; | 128 float imageIncrement[2]; |
129 imageIncrement[0] = 1.0f / texture.width(); | 129 imageIncrement[0] = 1.0f / texture.width(); |
130 imageIncrement[1] = 1.0f / texture.height(); | 130 imageIncrement[1] = 1.0f / texture.height(); |
131 pdman.set2fv(fImageIncrementUni, 1, imageIncrement); | 131 pdman.set2fv(fImageIncrementUni, 1, imageIncrement); |
132 pdman.setMatrix4f(fCoefficientsUni, bicubicEffect.coefficients()); | 132 pdman.setMatrix4f(fCoefficientsUni, bicubicEffect.coefficients()); |
133 fDomain.setData(pdman, bicubicEffect.domain(), texture.origin()); | 133 fDomain.setData(pdman, bicubicEffect.domain(), texture.origin()); |
134 if (SkToBool(bicubicEffect.colorSpaceXform())) { | 134 if (SkToBool(bicubicEffect.colorSpaceXform())) { |
135 float xformMatrix[16]; | 135 pdman.setMatrix4f(fColorSpaceXformUni, bicubicEffect.colorSpaceXform()->
srcToDst()); |
136 bicubicEffect.colorSpaceXform()->srcToDst().asColMajorf(xformMatrix); | |
137 pdman.setMatrix4f(fColorSpaceXformUni, xformMatrix); | |
138 } | 136 } |
139 } | 137 } |
140 | 138 |
141 static inline void convert_row_major_scalar_coeffs_to_column_major_floats(float
dst[16], | 139 static inline void convert_row_major_scalar_coeffs_to_column_major_floats(float
dst[16], |
142 const
SkScalar src[16]) { | 140 const
SkScalar src[16]) { |
143 for (int y = 0; y < 4; y++) { | 141 for (int y = 0; y < 4; y++) { |
144 for (int x = 0; x < 4; x++) { | 142 for (int x = 0; x < 4; x++) { |
145 dst[x * 4 + y] = SkScalarToFloat(src[y * 4 + x]); | 143 dst[x * 4 + y] = SkScalarToFloat(src[y * 4 + x]); |
146 } | 144 } |
147 } | 145 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // Use bilerp to handle rotation or fractional translation. | 231 // Use bilerp to handle rotation or fractional translation. |
234 *filterMode = GrTextureParams::kBilerp_FilterMode; | 232 *filterMode = GrTextureParams::kBilerp_FilterMode; |
235 } | 233 } |
236 return false; | 234 return false; |
237 } | 235 } |
238 // When we use the bicubic filtering effect each sample is read from the tex
ture using | 236 // When we use the bicubic filtering effect each sample is read from the tex
ture using |
239 // nearest neighbor sampling. | 237 // nearest neighbor sampling. |
240 *filterMode = GrTextureParams::kNone_FilterMode; | 238 *filterMode = GrTextureParams::kNone_FilterMode; |
241 return true; | 239 return true; |
242 } | 240 } |
OLD | NEW |