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

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

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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/GrBezierEffect.cpp ('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 const GrFragmentProcessor* Create(GrTexture* tex, const SkScalar coef ficients[16], 35 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, const SkScalar coeffi cients[16],
36 const SkRect* domain = nullptr) { 36 const SkRect* domain = nullptr) {
37 if (nullptr == domain) { 37 if (nullptr == domain) {
38 static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_Ti leMode, 38 static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_Ti leMode,
39 SkShader::kClamp_Ti leMode }; 39 SkShader::kClamp_Ti leMode };
40 return Create(tex, coefficients, GrCoordTransform::MakeDivByTextureW HMatrix(tex), 40 return Make(tex, coefficients, GrCoordTransform::MakeDivByTextureWHM atrix(tex),
41 kTileModes); 41 kTileModes);
42 } else { 42 } else {
43 return new GrBicubicEffect(tex, coefficients, 43 return sk_sp<GrFragmentProcessor>(
44 GrCoordTransform::MakeDivByTextureWHMatri x(tex), *domain); 44 new GrBicubicEffect(tex, coefficients,
45 GrCoordTransform::MakeDivByTextureWHMatrix(t ex), *domain));
45 } 46 }
46 } 47 }
47 48
48 /** 49 /**
49 * Create a Mitchell filter effect with specified texture matrix and x/y til e modes. 50 * Create a Mitchell filter effect with specified texture matrix and x/y til e modes.
50 */ 51 */
51 static const GrFragmentProcessor* Create(GrTexture* tex, const SkMatrix& mat rix, 52 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, const SkMatrix& matri x,
52 const SkShader::TileMode tileModes[ 2]) { 53 const SkShader::TileMode tileModes[2] ) {
53 return Create(tex, gMitchellCoefficients, matrix, tileModes); 54 return Make(tex, gMitchellCoefficients, matrix, tileModes);
54 } 55 }
55 56
56 /** 57 /**
57 * Create a filter effect with custom bicubic coefficients, the texture matr ix, and the x/y 58 * Create a filter effect with custom bicubic coefficients, the texture matr ix, and the x/y
58 * tilemodes. 59 * tilemodes.
59 */ 60 */
60 static const GrFragmentProcessor* Create(GrTexture* tex, const SkScalar coef ficients[16], 61 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, const SkScalar coeffi cients[16],
61 const SkMatrix& matrix, 62 const SkMatrix& matrix,
62 const SkShader::TileMode tileModes[ 2]) { 63 const SkShader::TileMode tileModes[2] ) {
63 return new GrBicubicEffect(tex, coefficients, matrix, tileModes); 64 return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(tex, coefficients, matrix,
65 tileModes));
64 } 66 }
65 67
66 /** 68 /**
67 * Create a Mitchell filter effect with a texture matrix and a domain. 69 * Create a Mitchell filter effect with a texture matrix and a domain.
68 */ 70 */
69 static const GrFragmentProcessor* Create(GrTexture* tex, const SkMatrix& mat rix, 71 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, const SkMatrix& matri x,
70 const SkRect& domain) { 72 const SkRect& domain) {
71 return new GrBicubicEffect(tex, gMitchellCoefficients, matrix, domain); 73 return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(tex, gMitchellCoef ficients, matrix,
74 domain));
72 } 75 }
73 76
74 /** 77 /**
75 * Determines whether the bicubic effect should be used based on the transfo rmation from the 78 * Determines whether the bicubic effect should be used based on the transfo rmation from the
76 * local coords to the device. Returns true if the bicubic effect should be used. filterMode 79 * local coords to the device. Returns true if the bicubic effect should be used. filterMode
77 * is set to appropriate filtering mode to use regardless of the return resu lt (e.g. when this 80 * is set to appropriate filtering mode to use regardless of the return resu lt (e.g. when this
78 * returns false it may indicate that the best fallback is to use kMipMap, k Bilerp, or 81 * returns false it may indicate that the best fallback is to use kMipMap, k Bilerp, or
79 * kNearest). 82 * kNearest).
80 */ 83 */
81 static bool ShouldUseBicubic(const SkMatrix& localCoordsToDevice, 84 static bool ShouldUseBicubic(const SkMatrix& localCoordsToDevice,
(...skipping 17 matching lines...) Expand all
99 GrTextureDomain fDomain; 102 GrTextureDomain fDomain;
100 103
101 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 104 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
102 105
103 static const SkScalar gMitchellCoefficients[16]; 106 static const SkScalar gMitchellCoefficients[16];
104 107
105 typedef GrSingleTextureEffect INHERITED; 108 typedef GrSingleTextureEffect INHERITED;
106 }; 109 };
107 110
108 #endif 111 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBezierEffect.cpp ('k') | src/gpu/effects/GrBicubicEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698