OLD | NEW |
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 GrDistanceFieldTextureEffect_DEFINED | 8 #ifndef GrDistanceFieldTextureEffect_DEFINED |
9 #define GrDistanceFieldTextureEffect_DEFINED | 9 #define GrDistanceFieldTextureEffect_DEFINED |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& pa
rams, | 51 static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& pa
rams, |
52 uint32_t flags) { | 52 uint32_t flags) { |
53 return SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, flags)); | 53 return SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, flags)); |
54 } | 54 } |
55 #endif | 55 #endif |
56 | 56 |
57 virtual ~GrDistanceFieldTextureEffect() {} | 57 virtual ~GrDistanceFieldTextureEffect() {} |
58 | 58 |
59 static const char* Name() { return "DistanceFieldTexture"; } | 59 static const char* Name() { return "DistanceFieldTexture"; } |
60 | 60 |
61 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; | |
62 | |
63 const GrShaderVar& inTextureCoords() const { return fInTextureCoords; } | 61 const GrShaderVar& inTextureCoords() const { return fInTextureCoords; } |
64 #ifdef SK_GAMMA_APPLY_TO_A8 | 62 #ifdef SK_GAMMA_APPLY_TO_A8 |
65 float getLuminance() const { return fLuminance; } | 63 float getLuminance() const { return fLuminance; } |
66 #endif | 64 #endif |
67 uint32_t getFlags() const { return fFlags; } | 65 uint32_t getFlags() const { return fFlags; } |
68 | 66 |
69 typedef GrGLDistanceFieldTextureEffect GLProcessor; | 67 typedef GrGLDistanceFieldTextureEffect GLProcessor; |
70 | 68 |
71 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; | 69 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; |
72 | 70 |
73 private: | 71 private: |
74 GrDistanceFieldTextureEffect(GrTexture* texture, const GrTextureParams& para
ms, | 72 GrDistanceFieldTextureEffect(GrTexture* texture, const GrTextureParams& para
ms, |
75 #ifdef SK_GAMMA_APPLY_TO_A8 | 73 #ifdef SK_GAMMA_APPLY_TO_A8 |
76 GrTexture* gamma, const GrTextureParams& gammaP
arams, float lum, | 74 GrTexture* gamma, const GrTextureParams& gammaP
arams, float lum, |
77 #endif | 75 #endif |
78 uint32_t flags); | 76 uint32_t flags); |
79 | 77 |
80 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 78 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; |
81 | 79 |
| 80 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; |
| 81 |
82 GrTextureAccess fTextureAccess; | 82 GrTextureAccess fTextureAccess; |
83 #ifdef SK_GAMMA_APPLY_TO_A8 | 83 #ifdef SK_GAMMA_APPLY_TO_A8 |
84 GrTextureAccess fGammaTextureAccess; | 84 GrTextureAccess fGammaTextureAccess; |
85 float fLuminance; | 85 float fLuminance; |
86 #endif | 86 #endif |
87 uint32_t fFlags; | 87 uint32_t fFlags; |
88 const GrShaderVar& fInTextureCoords; | 88 const GrShaderVar& fInTextureCoords; |
89 | 89 |
90 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 90 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
91 | 91 |
(...skipping 13 matching lines...) Expand all Loading... |
105 SkColor textColor, uint32_t flags) { | 105 SkColor textColor, uint32_t flags) { |
106 return SkNEW_ARGS(GrDistanceFieldLCDTextureEffect, | 106 return SkNEW_ARGS(GrDistanceFieldLCDTextureEffect, |
107 (tex, params, gamma, gammaParams, textColor, flags)); | 107 (tex, params, gamma, gammaParams, textColor, flags)); |
108 } | 108 } |
109 | 109 |
110 virtual ~GrDistanceFieldLCDTextureEffect() {} | 110 virtual ~GrDistanceFieldLCDTextureEffect() {} |
111 | 111 |
112 static const char* Name() { return "DistanceFieldLCDTexture"; } | 112 static const char* Name() { return "DistanceFieldLCDTexture"; } |
113 | 113 |
114 const GrShaderVar& inTextureCoords() const { return fInTextureCoords; } | 114 const GrShaderVar& inTextureCoords() const { return fInTextureCoords; } |
115 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; | |
116 GrColor getTextColor() const { return fTextColor; } | 115 GrColor getTextColor() const { return fTextColor; } |
117 uint32_t getFlags() const { return fFlags; } | 116 uint32_t getFlags() const { return fFlags; } |
118 | 117 |
119 typedef GrGLDistanceFieldLCDTextureEffect GLProcessor; | 118 typedef GrGLDistanceFieldLCDTextureEffect GLProcessor; |
120 | 119 |
121 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; | 120 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; |
122 | 121 |
123 private: | 122 private: |
124 GrDistanceFieldLCDTextureEffect(GrTexture* texture, const GrTextureParams& p
arams, | 123 GrDistanceFieldLCDTextureEffect(GrTexture* texture, const GrTextureParams& p
arams, |
125 GrTexture* gamma, const GrTextureParams& gam
maParams, | 124 GrTexture* gamma, const GrTextureParams& gam
maParams, |
126 SkColor textColor, | 125 SkColor textColor, |
127 uint32_t flags); | 126 uint32_t flags); |
128 | 127 |
129 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 128 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; |
130 | 129 |
| 130 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; |
| 131 |
131 GrTextureAccess fTextureAccess; | 132 GrTextureAccess fTextureAccess; |
132 GrTextureAccess fGammaTextureAccess; | 133 GrTextureAccess fGammaTextureAccess; |
133 GrColor fTextColor; | 134 GrColor fTextColor; |
134 uint32_t fFlags; | 135 uint32_t fFlags; |
135 const GrShaderVar& fInTextureCoords; | 136 const GrShaderVar& fInTextureCoords; |
136 | 137 |
137 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 138 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
138 | 139 |
139 typedef GrFragmentProcessor INHERITED; | 140 typedef GrFragmentProcessor INHERITED; |
140 }; | 141 }; |
141 | 142 |
142 #endif | 143 #endif |
OLD | NEW |