commit-bot@chromium.org | 76eaf74 | 2013-09-30 18:41:38 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef GrCustomCoordsTextureEffect_DEFINED |
| 9 | #define GrCustomCoordsTextureEffect_DEFINED |
| 10 | |
| 11 | #include "GrEffect.h" |
commit-bot@chromium.org | 234d4fb | 2013-09-30 19:55:49 +0000 | [diff] [blame] | 12 | #include "GrVertexEffect.h" |
commit-bot@chromium.org | 76eaf74 | 2013-09-30 18:41:38 +0000 | [diff] [blame] | 13 | |
| 14 | class GrGLCustomCoordsTextureEffect; |
| 15 | |
| 16 | /** |
| 17 | * The output color of this effect is a modulation of the input color and a sample from a texture. |
| 18 | * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input |
| 19 | * coords are a custom attribute. |
| 20 | */ |
commit-bot@chromium.org | 234d4fb | 2013-09-30 19:55:49 +0000 | [diff] [blame] | 21 | class GrCustomCoordsTextureEffect : public GrVertexEffect { |
commit-bot@chromium.org | 76eaf74 | 2013-09-30 18:41:38 +0000 | [diff] [blame] | 22 | public: |
| 23 | static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& p) { |
| 24 | AutoEffectUnref effect(SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p))); |
| 25 | return CreateEffectRef(effect); |
| 26 | } |
| 27 | |
| 28 | virtual ~GrCustomCoordsTextureEffect() {} |
| 29 | |
| 30 | static const char* Name() { return "Texture"; } |
| 31 | |
| 32 | virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; |
| 33 | |
| 34 | typedef GrGLCustomCoordsTextureEffect GLEffect; |
| 35 | |
| 36 | virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
| 37 | |
| 38 | private: |
| 39 | GrCustomCoordsTextureEffect(GrTexture* texture, const GrTextureParams& params); |
| 40 | |
| 41 | virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; |
| 42 | |
| 43 | GrTextureAccess fTextureAccess; |
| 44 | |
| 45 | GR_DECLARE_EFFECT_TEST; |
| 46 | |
commit-bot@chromium.org | 234d4fb | 2013-09-30 19:55:49 +0000 | [diff] [blame] | 47 | typedef GrVertexEffect INHERITED; |
commit-bot@chromium.org | 76eaf74 | 2013-09-30 18:41:38 +0000 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | #endif |