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

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

Issue 2154753003: Introduce GrColorSpaceXform, for gamut conversion on textures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More progress & refactoring Created 4 years, 5 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
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 GrSimpleTextureEffect_DEFINED 8 #ifndef GrSimpleTextureEffect_DEFINED
9 #define GrSimpleTextureEffect_DEFINED 9 #define GrSimpleTextureEffect_DEFINED
10 10
11 #include "GrSingleTextureEffect.h" 11 #include "GrSingleTextureEffect.h"
12 12
13 class GrInvariantOutput; 13 class GrInvariantOutput;
14 14
15 /** 15 /**
16 * The output color of this effect is a modulation of the input color and a samp le from a texture. 16 * The output color of this effect is a modulation of the input color and a samp le from a texture.
17 * It allows explicit specification of the filtering and wrap modes (GrTexturePa rams). It can use 17 * It allows explicit specification of the filtering and wrap modes (GrTexturePa rams). It can use
18 * local coords or device space coords as input texture coords. The input coords may be transformed 18 * local coords or device space coords as input texture coords. The input coords may be transformed
19 * by a matrix. 19 * by a matrix.
20 */ 20 */
21 class GrSimpleTextureEffect : public GrSingleTextureEffect { 21 class GrSimpleTextureEffect : public GrSingleTextureEffect {
22 public: 22 public:
23 /* unfiltered, clamp mode */ 23 /* unfiltered, clamp mode */
24 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, 24 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex,
25 sk_sp<GrColorSpaceXform> colorSpaceXf orm,
25 const SkMatrix& matrix, 26 const SkMatrix& matrix,
26 GrCoordSet coordSet = kLocal_GrCoordS et) { 27 GrCoordSet coordSet = kLocal_GrCoordS et) {
27 return sk_sp<GrFragmentProcessor>( 28 return sk_sp<GrFragmentProcessor>(
28 new GrSimpleTextureEffect(tex, matrix, GrTextureParams::kNone_Filter Mode, coordSet)); 29 new GrSimpleTextureEffect(tex, std::move(colorSpaceXform), matrix,
30 GrTextureParams::kNone_FilterMode, coordSe t));
29 } 31 }
30 32
31 /* clamp mode */ 33 /* clamp mode */
32 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, 34 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex,
35 sk_sp<GrColorSpaceXform> colorSpaceXf orm,
33 const SkMatrix& matrix, 36 const SkMatrix& matrix,
34 GrTextureParams::FilterMode filterMo de, 37 GrTextureParams::FilterMode filterMo de,
35 GrCoordSet coordSet = kLocal_GrCoord Set) { 38 GrCoordSet coordSet = kLocal_GrCoord Set) {
36 return sk_sp<GrFragmentProcessor>( 39 return sk_sp<GrFragmentProcessor>(
37 new GrSimpleTextureEffect(tex, matrix, filterMode, coordSet)); 40 new GrSimpleTextureEffect(tex, std::move(colorSpaceXform), matrix, f ilterMode,
41 coordSet));
38 } 42 }
39 43
40 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, 44 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex,
45 sk_sp<GrColorSpaceXform> colorSpaceXf orm,
41 const SkMatrix& matrix, 46 const SkMatrix& matrix,
42 const GrTextureParams& p, 47 const GrTextureParams& p,
43 GrCoordSet coordSet = kLocal_GrCoordS et) { 48 GrCoordSet coordSet = kLocal_GrCoordS et) {
44 return sk_sp<GrFragmentProcessor>(new GrSimpleTextureEffect(tex, matrix, p, coordSet)); 49 return sk_sp<GrFragmentProcessor>(new GrSimpleTextureEffect(tex, std::mo ve(colorSpaceXform),
50 matrix, p, c oordSet));
45 } 51 }
46 52
47 virtual ~GrSimpleTextureEffect() {} 53 virtual ~GrSimpleTextureEffect() {}
48 54
49 const char* name() const override { return "SimpleTexture"; } 55 const char* name() const override { return "SimpleTexture"; }
50 56
51 private: 57 private:
52 GrSimpleTextureEffect(GrTexture* texture, 58 GrSimpleTextureEffect(GrTexture* texture,
59 sk_sp<GrColorSpaceXform> colorSpaceXform,
53 const SkMatrix& matrix, 60 const SkMatrix& matrix,
54 GrTextureParams::FilterMode filterMode, 61 GrTextureParams::FilterMode filterMode,
55 GrCoordSet coordSet) 62 GrCoordSet coordSet)
56 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) { 63 : GrSingleTextureEffect(texture, std::move(colorSpaceXform), matrix, fil terMode, coordSet) {
57 this->initClassID<GrSimpleTextureEffect>(); 64 this->initClassID<GrSimpleTextureEffect>();
58 } 65 }
59 66
60 GrSimpleTextureEffect(GrTexture* texture, 67 GrSimpleTextureEffect(GrTexture* texture,
68 sk_sp<GrColorSpaceXform> colorSpaceXform,
61 const SkMatrix& matrix, 69 const SkMatrix& matrix,
62 const GrTextureParams& params, 70 const GrTextureParams& params,
63 GrCoordSet coordSet) 71 GrCoordSet coordSet)
64 : GrSingleTextureEffect(texture, matrix, params, coordSet) { 72 : GrSingleTextureEffect(texture, std::move(colorSpaceXform), matrix, par ams, coordSet) {
65 this->initClassID<GrSimpleTextureEffect>(); 73 this->initClassID<GrSimpleTextureEffect>();
66 } 74 }
67 75
68 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; 76 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
69 77
70 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; 78 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
71 79
72 bool onIsEqual(const GrFragmentProcessor& other) const override { return tru e; } 80 bool onIsEqual(const GrFragmentProcessor& other) const override { return tru e; }
73 81
74 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; 82 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
75 83
76 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 84 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
77 85
78 typedef GrSingleTextureEffect INHERITED; 86 typedef GrSingleTextureEffect INHERITED;
79 }; 87 };
80 88
81 #endif 89 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrMatrixConvolutionEffect.cpp ('k') | src/gpu/effects/GrSimpleTextureEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698