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 "gl/builders/GrGLProgramBuilder.h" | 10 #include "gl/builders/GrGLProgramBuilder.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 virtual void emitCode(GrGLFPBuilder*, | 26 virtual void emitCode(GrGLFPBuilder*, |
27 const GrFragmentProcessor&, | 27 const GrFragmentProcessor&, |
28 const char* outputColor, | 28 const char* outputColor, |
29 const char* inputColor, | 29 const char* inputColor, |
30 const TransformedCoordsArray&, | 30 const TransformedCoordsArray&, |
31 const TextureSamplerArray&) override; | 31 const TextureSamplerArray&) override; |
32 | 32 |
33 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; | 33 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; |
34 | 34 |
35 static inline void GenKey(const GrProcessor& effect, const GrGLCaps&, | 35 static inline void GenKey(const GrProcessor& effect, const GrGLSLCaps&, |
36 GrProcessorKeyBuilder* b) { | 36 GrProcessorKeyBuilder* b) { |
37 const GrTextureDomain& domain = effect.cast<GrBicubicEffect>().domain(); | 37 const GrTextureDomain& domain = effect.cast<GrBicubicEffect>().domain(); |
38 b->add32(GrTextureDomain::GLDomain::DomainKey(domain)); | 38 b->add32(GrTextureDomain::GLDomain::DomainKey(domain)); |
39 } | 39 } |
40 | 40 |
41 private: | 41 private: |
42 typedef GrGLProgramDataManager::UniformHandle UniformHandle; | 42 typedef GrGLProgramDataManager::UniformHandle UniformHandle; |
43 | 43 |
44 UniformHandle fCoefficientsUni; | 44 UniformHandle fCoefficientsUni; |
45 UniformHandle fImageIncrementUni; | 45 UniformHandle fImageIncrementUni; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 : INHERITED(texture, matrix, GrTextureParams(SkShader::kClamp_TileMode, | 151 : INHERITED(texture, matrix, GrTextureParams(SkShader::kClamp_TileMode, |
152 GrTextureParams::kNone_FilterMode
)) | 152 GrTextureParams::kNone_FilterMode
)) |
153 , fDomain(domain, GrTextureDomain::kClamp_Mode) { | 153 , fDomain(domain, GrTextureDomain::kClamp_Mode) { |
154 this->initClassID<GrBicubicEffect>(); | 154 this->initClassID<GrBicubicEffect>(); |
155 convert_row_major_scalar_coeffs_to_column_major_floats(fCoefficients, coeffi
cients); | 155 convert_row_major_scalar_coeffs_to_column_major_floats(fCoefficients, coeffi
cients); |
156 } | 156 } |
157 | 157 |
158 GrBicubicEffect::~GrBicubicEffect() { | 158 GrBicubicEffect::~GrBicubicEffect() { |
159 } | 159 } |
160 | 160 |
161 void GrBicubicEffect::getGLProcessorKey(const GrGLCaps& caps, | 161 void GrBicubicEffect::getGLProcessorKey(const GrGLSLCaps& caps, |
162 GrProcessorKeyBuilder* b) const { | 162 GrProcessorKeyBuilder* b) const { |
163 GrGLBicubicEffect::GenKey(*this, caps, b); | 163 GrGLBicubicEffect::GenKey(*this, caps, b); |
164 } | 164 } |
165 | 165 |
166 GrGLFragmentProcessor* GrBicubicEffect::createGLInstance() const { | 166 GrGLFragmentProcessor* GrBicubicEffect::createGLInstance() const { |
167 return SkNEW_ARGS(GrGLBicubicEffect, (*this)); | 167 return SkNEW_ARGS(GrGLBicubicEffect, (*this)); |
168 } | 168 } |
169 | 169 |
170 bool GrBicubicEffect::onIsEqual(const GrFragmentProcessor& sBase) const { | 170 bool GrBicubicEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
171 const GrBicubicEffect& s = sBase.cast<GrBicubicEffect>(); | 171 const GrBicubicEffect& s = sBase.cast<GrBicubicEffect>(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // Use bilerp to handle rotation or fractional translation. | 218 // Use bilerp to handle rotation or fractional translation. |
219 *filterMode = GrTextureParams::kBilerp_FilterMode; | 219 *filterMode = GrTextureParams::kBilerp_FilterMode; |
220 } | 220 } |
221 return false; | 221 return false; |
222 } | 222 } |
223 // When we use the bicubic filtering effect each sample is read from the tex
ture using | 223 // When we use the bicubic filtering effect each sample is read from the tex
ture using |
224 // nearest neighbor sampling. | 224 // nearest neighbor sampling. |
225 *filterMode = GrTextureParams::kNone_FilterMode; | 225 *filterMode = GrTextureParams::kNone_FilterMode; |
226 return true; | 226 return true; |
227 } | 227 } |
OLD | NEW |