| 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 |
| 61 const GrShaderVar& inTextureCoords() const { return fInTextureCoords; } | 63 const GrShaderVar& inTextureCoords() const { return fInTextureCoords; } |
| 62 #ifdef SK_GAMMA_APPLY_TO_A8 | 64 #ifdef SK_GAMMA_APPLY_TO_A8 |
| 63 float getLuminance() const { return fLuminance; } | 65 float getLuminance() const { return fLuminance; } |
| 64 #endif | 66 #endif |
| 65 uint32_t getFlags() const { return fFlags; } | 67 uint32_t getFlags() const { return fFlags; } |
| 66 | 68 |
| 67 typedef GrGLDistanceFieldTextureEffect GLProcessor; | 69 typedef GrGLDistanceFieldTextureEffect GLProcessor; |
| 68 | 70 |
| 69 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; | 71 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; |
| 70 | 72 |
| 71 private: | 73 private: |
| 72 GrDistanceFieldTextureEffect(GrTexture* texture, const GrTextureParams& para
ms, | 74 GrDistanceFieldTextureEffect(GrTexture* texture, const GrTextureParams& para
ms, |
| 73 #ifdef SK_GAMMA_APPLY_TO_A8 | 75 #ifdef SK_GAMMA_APPLY_TO_A8 |
| 74 GrTexture* gamma, const GrTextureParams& gammaP
arams, float lum, | 76 GrTexture* gamma, const GrTextureParams& gammaP
arams, float lum, |
| 75 #endif | 77 #endif |
| 76 uint32_t flags); | 78 uint32_t flags); |
| 77 | 79 |
| 78 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 80 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; |
| 79 | 81 |
| 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; |
| 115 GrColor getTextColor() const { return fTextColor; } | 116 GrColor getTextColor() const { return fTextColor; } |
| 116 uint32_t getFlags() const { return fFlags; } | 117 uint32_t getFlags() const { return fFlags; } |
| 117 | 118 |
| 118 typedef GrGLDistanceFieldLCDTextureEffect GLProcessor; | 119 typedef GrGLDistanceFieldLCDTextureEffect GLProcessor; |
| 119 | 120 |
| 120 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; | 121 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; |
| 121 | 122 |
| 122 private: | 123 private: |
| 123 GrDistanceFieldLCDTextureEffect(GrTexture* texture, const GrTextureParams& p
arams, | 124 GrDistanceFieldLCDTextureEffect(GrTexture* texture, const GrTextureParams& p
arams, |
| 124 GrTexture* gamma, const GrTextureParams& gam
maParams, | 125 GrTexture* gamma, const GrTextureParams& gam
maParams, |
| 125 SkColor textColor, | 126 SkColor textColor, |
| 126 uint32_t flags); | 127 uint32_t flags); |
| 127 | 128 |
| 128 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 129 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; |
| 129 | 130 |
| 130 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | |
| 131 | |
| 132 GrTextureAccess fTextureAccess; | 131 GrTextureAccess fTextureAccess; |
| 133 GrTextureAccess fGammaTextureAccess; | 132 GrTextureAccess fGammaTextureAccess; |
| 134 GrColor fTextColor; | 133 GrColor fTextColor; |
| 135 uint32_t fFlags; | 134 uint32_t fFlags; |
| 136 const GrShaderVar& fInTextureCoords; | 135 const GrShaderVar& fInTextureCoords; |
| 137 | 136 |
| 138 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 137 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 139 | 138 |
| 140 typedef GrFragmentProcessor INHERITED; | 139 typedef GrFragmentProcessor INHERITED; |
| 141 }; | 140 }; |
| 142 | 141 |
| 143 #endif | 142 #endif |
| OLD | NEW |