Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: src/gpu/effects/GrBicubicEffect.cpp

Issue 755363002: remove proc key (Closed) Base URL: https://skia.googlesource.com/skia.git@fixkey
Patch Set: address nit Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrProgramDesc.h ('k') | src/gpu/effects/GrConfigConversionEffect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "gl/builders/GrGLProgramBuilder.h" 8 #include "gl/builders/GrGLProgramBuilder.h"
9 #include "GrBicubicEffect.h" 9 #include "GrBicubicEffect.h"
10 #include "GrInvariantOutput.h" 10 #include "GrInvariantOutput.h"
11 11
12 #define DS(x) SkDoubleToScalar(x) 12 #define DS(x) SkDoubleToScalar(x)
13 13
14 const SkScalar GrBicubicEffect::gMitchellCoefficients[16] = { 14 const SkScalar GrBicubicEffect::gMitchellCoefficients[16] = {
15 DS( 1.0 / 18.0), DS(-9.0 / 18.0), DS( 15.0 / 18.0), DS( -7.0 / 18.0), 15 DS( 1.0 / 18.0), DS(-9.0 / 18.0), DS( 15.0 / 18.0), DS( -7.0 / 18.0),
16 DS(16.0 / 18.0), DS( 0.0 / 18.0), DS(-36.0 / 18.0), DS( 21.0 / 18.0), 16 DS(16.0 / 18.0), DS( 0.0 / 18.0), DS(-36.0 / 18.0), DS( 21.0 / 18.0),
17 DS( 1.0 / 18.0), DS( 9.0 / 18.0), DS( 27.0 / 18.0), DS(-21.0 / 18.0), 17 DS( 1.0 / 18.0), DS( 9.0 / 18.0), DS( 27.0 / 18.0), DS(-21.0 / 18.0),
18 DS( 0.0 / 18.0), DS( 0.0 / 18.0), DS( -6.0 / 18.0), DS( 7.0 / 18.0), 18 DS( 0.0 / 18.0), DS( 0.0 / 18.0), DS( -6.0 / 18.0), DS( 7.0 / 18.0),
19 }; 19 };
20 20
21 21
22 class GrGLBicubicEffect : public GrGLFragmentProcessor { 22 class GrGLBicubicEffect : public GrGLFragmentProcessor {
23 public: 23 public:
24 GrGLBicubicEffect(const GrBackendProcessorFactory& factory, 24 GrGLBicubicEffect(const GrBackendProcessorFactory& factory,
25 const GrProcessor&); 25 const GrProcessor&);
26 26
27 virtual void emitCode(GrGLFPBuilder*, 27 virtual void emitCode(GrGLFPBuilder*,
28 const GrFragmentProcessor&, 28 const GrFragmentProcessor&,
29 const GrProcessorKey&,
30 const char* outputColor, 29 const char* outputColor,
31 const char* inputColor, 30 const char* inputColor,
32 const TransformedCoordsArray&, 31 const TransformedCoordsArray&,
33 const TextureSamplerArray&) SK_OVERRIDE; 32 const TextureSamplerArray&) SK_OVERRIDE;
34 33
35 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O VERRIDE; 34 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O VERRIDE;
36 35
37 static inline void GenKey(const GrProcessor& effect, const GrGLCaps&, 36 static inline void GenKey(const GrProcessor& effect, const GrGLCaps&,
38 GrProcessorKeyBuilder* b) { 37 GrProcessorKeyBuilder* b) {
39 const GrTextureDomain& domain = effect.cast<GrBicubicEffect>().domain(); 38 const GrTextureDomain& domain = effect.cast<GrBicubicEffect>().domain();
40 b->add32(GrTextureDomain::GLDomain::DomainKey(domain)); 39 b->add32(GrTextureDomain::GLDomain::DomainKey(domain));
41 } 40 }
42 41
43 private: 42 private:
44 typedef GrGLProgramDataManager::UniformHandle UniformHandle; 43 typedef GrGLProgramDataManager::UniformHandle UniformHandle;
45 44
46 UniformHandle fCoefficientsUni; 45 UniformHandle fCoefficientsUni;
47 UniformHandle fImageIncrementUni; 46 UniformHandle fImageIncrementUni;
48 GrTextureDomain::GLDomain fDomain; 47 GrTextureDomain::GLDomain fDomain;
49 48
50 typedef GrGLFragmentProcessor INHERITED; 49 typedef GrGLFragmentProcessor INHERITED;
51 }; 50 };
52 51
53 GrGLBicubicEffect::GrGLBicubicEffect(const GrBackendProcessorFactory& factory, c onst GrProcessor&) 52 GrGLBicubicEffect::GrGLBicubicEffect(const GrBackendProcessorFactory& factory, c onst GrProcessor&)
54 : INHERITED(factory) { 53 : INHERITED(factory) {
55 } 54 }
56 55
57 void GrGLBicubicEffect::emitCode(GrGLFPBuilder* builder, 56 void GrGLBicubicEffect::emitCode(GrGLFPBuilder* builder,
58 const GrFragmentProcessor& effect, 57 const GrFragmentProcessor& effect,
59 const GrProcessorKey& key,
60 const char* outputColor, 58 const char* outputColor,
61 const char* inputColor, 59 const char* inputColor,
62 const TransformedCoordsArray& coords, 60 const TransformedCoordsArray& coords,
63 const TextureSamplerArray& samplers) { 61 const TextureSamplerArray& samplers) {
64 const GrTextureDomain& domain = effect.cast<GrBicubicEffect>().domain(); 62 const GrTextureDomain& domain = effect.cast<GrBicubicEffect>().domain();
65 63
66 fCoefficientsUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibil ity, 64 fCoefficientsUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibil ity,
67 kMat44f_GrSLType, "Coefficients"); 65 kMat44f_GrSLType, "Coefficients");
68 fImageIncrementUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visib ility, 66 fImageIncrementUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visib ility,
69 kVec2f_GrSLType, "ImageIncrement"); 67 kVec2f_GrSLType, "ImageIncrement");
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // Use bilerp to handle rotation or fractional translation. 211 // Use bilerp to handle rotation or fractional translation.
214 *filterMode = GrTextureParams::kBilerp_FilterMode; 212 *filterMode = GrTextureParams::kBilerp_FilterMode;
215 } 213 }
216 return false; 214 return false;
217 } 215 }
218 // When we use the bicubic filtering effect each sample is read from the tex ture using 216 // When we use the bicubic filtering effect each sample is read from the tex ture using
219 // nearest neighbor sampling. 217 // nearest neighbor sampling.
220 *filterMode = GrTextureParams::kNone_FilterMode; 218 *filterMode = GrTextureParams::kNone_FilterMode;
221 return true; 219 return true;
222 } 220 }
OLDNEW
« no previous file with comments | « src/gpu/GrProgramDesc.h ('k') | src/gpu/effects/GrConfigConversionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698