| 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 onGetConstantColorComponents(GrColor* color, uint32_t* validFla
gs, |
| 81 bool* isSingleComponent) const SK_
OVERRIDE; |
| 82 |
| 82 GrTextureAccess fTextureAccess; | 83 GrTextureAccess fTextureAccess; |
| 83 #ifdef SK_GAMMA_APPLY_TO_A8 | 84 #ifdef SK_GAMMA_APPLY_TO_A8 |
| 84 GrTextureAccess fGammaTextureAccess; | 85 GrTextureAccess fGammaTextureAccess; |
| 85 float fLuminance; | 86 float fLuminance; |
| 86 #endif | 87 #endif |
| 87 uint32_t fFlags; | 88 uint32_t fFlags; |
| 88 const GrShaderVar& fInTextureCoords; | 89 const GrShaderVar& fInTextureCoords; |
| 89 | 90 |
| 90 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 91 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 91 | 92 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 105 SkColor textColor, uint32_t flags) { | 106 SkColor textColor, uint32_t flags) { |
| 106 return SkNEW_ARGS(GrDistanceFieldLCDTextureEffect, | 107 return SkNEW_ARGS(GrDistanceFieldLCDTextureEffect, |
| 107 (tex, params, gamma, gammaParams, textColor, flags)); | 108 (tex, params, gamma, gammaParams, textColor, flags)); |
| 108 } | 109 } |
| 109 | 110 |
| 110 virtual ~GrDistanceFieldLCDTextureEffect() {} | 111 virtual ~GrDistanceFieldLCDTextureEffect() {} |
| 111 | 112 |
| 112 static const char* Name() { return "DistanceFieldLCDTexture"; } | 113 static const char* Name() { return "DistanceFieldLCDTexture"; } |
| 113 | 114 |
| 114 const GrShaderVar& inTextureCoords() const { return fInTextureCoords; } | 115 const GrShaderVar& inTextureCoords() const { return fInTextureCoords; } |
| 115 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; | |
| 116 GrColor getTextColor() const { return fTextColor; } | 116 GrColor getTextColor() const { return fTextColor; } |
| 117 uint32_t getFlags() const { return fFlags; } | 117 uint32_t getFlags() const { return fFlags; } |
| 118 | 118 |
| 119 typedef GrGLDistanceFieldLCDTextureEffect GLProcessor; | 119 typedef GrGLDistanceFieldLCDTextureEffect GLProcessor; |
| 120 | 120 |
| 121 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; | 121 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 GrDistanceFieldLCDTextureEffect(GrTexture* texture, const GrTextureParams& p
arams, | 124 GrDistanceFieldLCDTextureEffect(GrTexture* texture, const GrTextureParams& p
arams, |
| 125 GrTexture* gamma, const GrTextureParams& gam
maParams, | 125 GrTexture* gamma, const GrTextureParams& gam
maParams, |
| 126 SkColor textColor, | 126 SkColor textColor, |
| 127 uint32_t flags); | 127 uint32_t flags); |
| 128 | 128 |
| 129 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 129 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; |
| 130 | 130 |
| 131 virtual void onGetConstantColorComponents(GrColor* color, uint32_t* validFla
gs, |
| 132 bool* isSingleComponent) const SK_
OVERRIDE; |
| 133 |
| 131 GrTextureAccess fTextureAccess; | 134 GrTextureAccess fTextureAccess; |
| 132 GrTextureAccess fGammaTextureAccess; | 135 GrTextureAccess fGammaTextureAccess; |
| 133 GrColor fTextColor; | 136 GrColor fTextColor; |
| 134 uint32_t fFlags; | 137 uint32_t fFlags; |
| 135 const GrShaderVar& fInTextureCoords; | 138 const GrShaderVar& fInTextureCoords; |
| 136 | 139 |
| 137 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 140 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 138 | 141 |
| 139 typedef GrFragmentProcessor INHERITED; | 142 typedef GrFragmentProcessor INHERITED; |
| 140 }; | 143 }; |
| 141 | 144 |
| 142 #endif | 145 #endif |
| OLD | NEW |