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

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

Issue 1388113002: Bye bye processor data manager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove files Created 5 years, 2 months 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/effects/Gr1DKernelEffect.h ('k') | src/gpu/effects/GrBicubicEffect.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 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 14 matching lines...) Expand all
25 25
26 const float* coefficients() const { return fCoefficients; } 26 const float* coefficients() const { return fCoefficients; }
27 27
28 const char* name() const override { return "Bicubic"; } 28 const char* name() const override { return "Bicubic"; }
29 29
30 const GrTextureDomain& domain() const { return fDomain; } 30 const GrTextureDomain& domain() const { return fDomain; }
31 31
32 /** 32 /**
33 * Create a simple filter effect with custom bicubic coefficients and option al domain. 33 * Create a simple filter effect with custom bicubic coefficients and option al domain.
34 */ 34 */
35 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex, 35 static GrFragmentProcessor* Create(GrTexture* tex, const SkScalar coefficien ts[16],
36 const SkScalar coefficients[16],
37 const SkRect* domain = nullptr) { 36 const SkRect* domain = nullptr) {
38 if (nullptr == domain) { 37 if (nullptr == domain) {
39 static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_Ti leMode, 38 static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_Ti leMode,
40 SkShader::kClamp_Ti leMode }; 39 SkShader::kClamp_Ti leMode };
41 return Create(procDataManager, tex, coefficients, 40 return Create(tex, coefficients, GrCoordTransform::MakeDivByTextureW HMatrix(tex),
42 GrCoordTransform::MakeDivByTextureWHMatrix(tex), kTile Modes); 41 kTileModes);
43 } else { 42 } else {
44 return new GrBicubicEffect(procDataManager, tex, coefficients, 43 return new GrBicubicEffect(tex, coefficients,
45 GrCoordTransform::MakeDivByTextureWHMatri x(tex), *domain); 44 GrCoordTransform::MakeDivByTextureWHMatri x(tex), *domain);
46 } 45 }
47 } 46 }
48 47
49 /** 48 /**
50 * Create a Mitchell filter effect with specified texture matrix and x/y til e modes. 49 * Create a Mitchell filter effect with specified texture matrix and x/y til e modes.
51 */ 50 */
52 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex, 51 static GrFragmentProcessor* Create(GrTexture* tex, const SkMatrix& matrix,
53 const SkMatrix& matrix,
54 SkShader::TileMode tileModes[2]) { 52 SkShader::TileMode tileModes[2]) {
55 return Create(procDataManager, tex, gMitchellCoefficients, matrix, tileM odes); 53 return Create(tex, gMitchellCoefficients, matrix, tileModes);
56 } 54 }
57 55
58 /** 56 /**
59 * Create a filter effect with custom bicubic coefficients, the texture matr ix, and the x/y 57 * Create a filter effect with custom bicubic coefficients, the texture matr ix, and the x/y
60 * tilemodes. 58 * tilemodes.
61 */ 59 */
62 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex, 60 static GrFragmentProcessor* Create(GrTexture* tex, const SkScalar coefficien ts[16],
63 const SkScalar coefficients[16], const Sk Matrix& matrix, 61 const SkMatrix& matrix,
64 const SkShader::TileMode tileModes[2]) { 62 const SkShader::TileMode tileModes[2]) {
65 return new GrBicubicEffect(procDataManager, tex, coefficients, matrix, t ileModes); 63 return new GrBicubicEffect(tex, coefficients, matrix, tileModes);
66 } 64 }
67 65
68 /** 66 /**
69 * Create a Mitchell filter effect with a texture matrix and a domain. 67 * Create a Mitchell filter effect with a texture matrix and a domain.
70 */ 68 */
71 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex, 69 static GrFragmentProcessor* Create(GrTexture* tex, const SkMatrix& matrix,
72 const SkMatrix& matrix, const SkRect& dom ain) { 70 const SkRect& domain) {
73 return new GrBicubicEffect(procDataManager, tex, gMitchellCoefficients, matrix, domain); 71 return new GrBicubicEffect(tex, gMitchellCoefficients, matrix, domain);
74 } 72 }
75 73
76 /** 74 /**
77 * Determines whether the bicubic effect should be used based on the transfo rmation from the 75 * Determines whether the bicubic effect should be used based on the transfo rmation from the
78 * local coords to the device. Returns true if the bicubic effect should be used. filterMode 76 * local coords to the device. Returns true if the bicubic effect should be used. filterMode
79 * is set to appropriate filtering mode to use regardless of the return resu lt (e.g. when this 77 * is set to appropriate filtering mode to use regardless of the return resu lt (e.g. when this
80 * returns false it may indicate that the best fallback is to use kMipMap, k Bilerp, or 78 * returns false it may indicate that the best fallback is to use kMipMap, k Bilerp, or
81 * kNearest). 79 * kNearest).
82 */ 80 */
83 static bool ShouldUseBicubic(const SkMatrix& localCoordsToDevice, 81 static bool ShouldUseBicubic(const SkMatrix& localCoordsToDevice,
84 GrTextureParams::FilterMode* filterMode); 82 GrTextureParams::FilterMode* filterMode);
85 83
86 private: 84 private:
87 GrBicubicEffect(GrProcessorDataManager*, GrTexture*, const SkScalar coeffici ents[16], 85 GrBicubicEffect(GrTexture*, const SkScalar coefficients[16], const SkMatrix &matrix,
88 const SkMatrix &matrix, const SkShader::TileMode tileModes[2 ]); 86 const SkShader::TileMode tileModes[2]);
89 GrBicubicEffect(GrProcessorDataManager*, GrTexture*, const SkScalar coeffici ents[16], 87 GrBicubicEffect(GrTexture*, const SkScalar coefficients[16], const SkMatrix &matrix,
90 const SkMatrix &matrix, const SkRect& domain); 88 const SkRect& domain);
91 89
92 GrGLFragmentProcessor* onCreateGLInstance() const override; 90 GrGLFragmentProcessor* onCreateGLInstance() const override;
93 91
94 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov erride; 92 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov erride;
95 93
96 bool onIsEqual(const GrFragmentProcessor&) const override; 94 bool onIsEqual(const GrFragmentProcessor&) const override;
97 95
98 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; 96 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
99 97
100 float fCoefficients[16]; 98 float fCoefficients[16];
101 GrTextureDomain fDomain; 99 GrTextureDomain fDomain;
102 100
103 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 101 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
104 102
105 static const SkScalar gMitchellCoefficients[16]; 103 static const SkScalar gMitchellCoefficients[16];
106 104
107 typedef GrSingleTextureEffect INHERITED; 105 typedef GrSingleTextureEffect INHERITED;
108 }; 106 };
109 107
110 #endif 108 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/Gr1DKernelEffect.h ('k') | src/gpu/effects/GrBicubicEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698