| 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 GrCustomCoordsTextureEffect_DEFINED | 8 #ifndef GrCustomCoordsTextureEffect_DEFINED |
| 9 #define GrCustomCoordsTextureEffect_DEFINED | 9 #define GrCustomCoordsTextureEffect_DEFINED |
| 10 | 10 |
| 11 #include "GrProcessor.h" | 11 #include "GrProcessor.h" |
| 12 #include "GrGeometryProcessor.h" | 12 #include "GrGeometryProcessor.h" |
| 13 | 13 |
| 14 class GrGLCustomCoordsTextureEffect; | 14 class GrGLCustomCoordsTextureEffect; |
| 15 class GrInvariantOutput; | 15 class GrInvariantOutput; |
| 16 | 16 |
| 17 /** | 17 /** |
| 18 * The output color of this effect is a modulation of the input color and a samp
le from a texture. | 18 * The output color of this effect is a modulation of the input color and a samp
le from a texture. |
| 19 * It allows explicit specification of the filtering and wrap modes (GrTexturePa
rams). The input | 19 * It allows explicit specification of the filtering and wrap modes (GrTexturePa
rams). The input |
| 20 * coords are a custom attribute. | 20 * coords are a custom attribute. |
| 21 */ | 21 */ |
| 22 class GrCustomCoordsTextureEffect : public GrGeometryProcessor { | 22 class GrCustomCoordsTextureEffect : public GrGeometryProcessor { |
| 23 public: | 23 public: |
| 24 static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& p,
bool hasColor) { | 24 static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& p,
bool hasColor) { |
| 25 return SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p, hasColor)); | 25 return SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p, hasColor)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual ~GrCustomCoordsTextureEffect() {} | 28 virtual ~GrCustomCoordsTextureEffect() {} |
| 29 | 29 |
| 30 static const char* Name() { return "Texture"; } | 30 virtual const char* name() const SK_OVERRIDE { return "Texture"; } |
| 31 | 31 |
| 32 const GrAttribute* inPosition() const { return fInPosition; } | 32 const GrAttribute* inPosition() const { return fInPosition; } |
| 33 const GrAttribute* inColor() const { return fInColor; } | 33 const GrAttribute* inColor() const { return fInColor; } |
| 34 const GrAttribute* inTextureCoords() const { return fInTextureCoords; } | 34 const GrAttribute* inTextureCoords() const { return fInTextureCoords; } |
| 35 | 35 |
| 36 typedef GrGLCustomCoordsTextureEffect GLProcessor; | 36 virtual void getGLProcessorKey(const GrBatchTracker& bt, |
| 37 const GrGLCaps& caps, |
| 38 GrProcessorKeyBuilder* b) const SK_OVERRIDE; |
| 37 | 39 |
| 38 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; | 40 virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) co
nst SK_OVERRIDE; |
| 41 |
| 42 virtual uint32_t classID() const { |
| 43 static uint32_t id = GenClassID(); |
| 44 return id; |
| 45 } |
| 39 | 46 |
| 40 private: | 47 private: |
| 41 GrCustomCoordsTextureEffect(GrTexture* texture, const GrTextureParams& param
s, bool hasColor); | 48 GrCustomCoordsTextureEffect(GrTexture* texture, const GrTextureParams& param
s, bool hasColor); |
| 42 | 49 |
| 43 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; | 50 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; |
| 44 | 51 |
| 45 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE; | 52 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE; |
| 46 | 53 |
| 47 GrTextureAccess fTextureAccess; | 54 GrTextureAccess fTextureAccess; |
| 48 const GrAttribute* fInPosition; | 55 const GrAttribute* fInPosition; |
| 49 const GrAttribute* fInColor; | 56 const GrAttribute* fInColor; |
| 50 const GrAttribute* fInTextureCoords; | 57 const GrAttribute* fInTextureCoords; |
| 51 | 58 |
| 52 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 59 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 53 | 60 |
| 54 typedef GrGeometryProcessor INHERITED; | 61 typedef GrGeometryProcessor INHERITED; |
| 55 }; | 62 }; |
| 56 | 63 |
| 57 #endif | 64 #endif |
| OLD | NEW |