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

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

Issue 582963002: Solo gp (Closed) Base URL: https://skia.googlesource.com/skia.git@no_peb
Patch Set: rebase Created 6 years, 3 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/GrRRectEffect.cpp ('k') | src/gpu/effects/GrSimpleTextureEffect.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 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 GrGLSimpleTextureEffect; 13 class GrGLSimpleTextureEffect;
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, positions, or a custom vertex attribute as input texture coords . The input coords 18 * local coords, positions, or a custom vertex attribute as input texture coords . The input coords
19 * can have a matrix applied in the VS in both the local and position cases but not with a custom 19 * can have a matrix applied in the VS in both the local and position cases but not with a custom
20 * attribute coords at this time. It will add a varying to input interpolate tex ture coords to the 20 * attribute coords at this time. It will add a varying to input interpolate tex ture coords to the
21 * FS. 21 * FS.
22 */ 22 */
23 class GrSimpleTextureEffect : public GrSingleTextureEffect { 23 class GrSimpleTextureEffect : public GrSingleTextureEffect {
24 public: 24 public:
25 /* unfiltered, clamp mode */ 25 /* unfiltered, clamp mode */
26 static GrEffect* Create(GrTexture* tex, 26 static GrFragmentProcessor* Create(GrTexture* tex,
27 const SkMatrix& matrix, 27 const SkMatrix& matrix,
28 GrCoordSet coordSet = kLocal_GrCoordSet) { 28 GrCoordSet coordSet = kLocal_GrCoordSet) {
29 return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, GrTextureParams:: kNone_FilterMode, 29 return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, GrTextureParams:: kNone_FilterMode,
30 coordSet)); 30 coordSet));
31 } 31 }
32 32
33 /* clamp mode */ 33 /* clamp mode */
34 static GrEffect* Create(GrTexture* tex, 34 static GrFragmentProcessor* Create(GrTexture* tex,
35 const SkMatrix& matrix, 35 const SkMatrix& matrix,
36 GrTextureParams::FilterMode filterMode, 36 GrTextureParams::FilterMode filterMode,
37 GrCoordSet coordSet = kLocal_GrCoordSet) { 37 GrCoordSet coordSet = kLocal_GrCoordSet) {
38 return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, filterMode, coord Set)); 38 return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, filterMode, coord Set));
39 } 39 }
40 40
41 static GrEffect* Create(GrTexture* tex, 41 static GrFragmentProcessor* Create(GrTexture* tex,
42 const SkMatrix& matrix, 42 const SkMatrix& matrix,
43 const GrTextureParams& p, 43 const GrTextureParams& p,
44 GrCoordSet coordSet = kLocal_GrCoordSet) { 44 GrCoordSet coordSet = kLocal_GrCoordSet) {
45 return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p, coordSet)); 45 return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p, coordSet));
46 } 46 }
47 47
48 virtual ~GrSimpleTextureEffect() {} 48 virtual ~GrSimpleTextureEffect() {}
49 49
50 static const char* Name() { return "Texture"; } 50 static const char* Name() { return "Texture"; }
51 51
52 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE; 52 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE;
53 53
54 typedef GrGLSimpleTextureEffect GLEffect; 54 typedef GrGLSimpleTextureEffect GLProcessor;
55 55
56 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; 56 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE;
57 57
58 private: 58 private:
59 GrSimpleTextureEffect(GrTexture* texture, 59 GrSimpleTextureEffect(GrTexture* texture,
60 const SkMatrix& matrix, 60 const SkMatrix& matrix,
61 GrTextureParams::FilterMode filterMode, 61 GrTextureParams::FilterMode filterMode,
62 GrCoordSet coordSet) 62 GrCoordSet coordSet)
63 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) { 63 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) {
64 } 64 }
65 65
66 GrSimpleTextureEffect(GrTexture* texture, 66 GrSimpleTextureEffect(GrTexture* texture,
67 const SkMatrix& matrix, 67 const SkMatrix& matrix,
68 const GrTextureParams& params, 68 const GrTextureParams& params,
69 GrCoordSet coordSet) 69 GrCoordSet coordSet)
70 : GrSingleTextureEffect(texture, matrix, params, coordSet) { 70 : GrSingleTextureEffect(texture, matrix, params, coordSet) {
71 } 71 }
72 72
73 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { 73 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE {
74 const GrSimpleTextureEffect& ste = other.cast<GrSimpleTextureEffect>(); 74 const GrSimpleTextureEffect& ste = other.cast<GrSimpleTextureEffect>();
75 return this->hasSameTextureParamsMatrixAndSourceCoords(ste); 75 return this->hasSameTextureParamsMatrixAndSourceCoords(ste);
76 } 76 }
77 77
78 GR_DECLARE_EFFECT_TEST; 78 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
79 79
80 typedef GrSingleTextureEffect INHERITED; 80 typedef GrSingleTextureEffect INHERITED;
81 }; 81 };
82 82
83 #endif 83 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrRRectEffect.cpp ('k') | src/gpu/effects/GrSimpleTextureEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698