Chromium Code Reviews| Index: src/gpu/effects/GrHQScaleTextureEffect.h |
| diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrHQScaleTextureEffect.h |
| similarity index 77% |
| copy from src/gpu/effects/GrSimpleTextureEffect.h |
| copy to src/gpu/effects/GrHQScaleTextureEffect.h |
| index bcce46b595bfa8c7ba70f95816b7255c9b104e07..447368daf81d8f413243f6af4ec65405860028ad 100644 |
| --- a/src/gpu/effects/GrSimpleTextureEffect.h |
| +++ b/src/gpu/effects/GrHQScaleTextureEffect.h |
| @@ -5,29 +5,32 @@ |
| * found in the LICENSE file. |
| */ |
| -#ifndef GrSimpleTextureEffect_DEFINED |
| -#define GrSimpleTextureEffect_DEFINED |
| +#ifndef GrHQScaleTextureEffect_DEFINED |
|
bsalomon
2013/09/03 20:55:17
Is this file and the cpp actually used? It looks l
humper
2013/09/03 21:45:53
Nope, this was an unintentional addition.
|
| +#define GrHQScaleTextureEffect_DEFINED |
| #include "GrSingleTextureEffect.h" |
| -class GrGLSimpleTextureEffect; |
| +class GrGLHQScaleTextureEffect; |
| /** |
| - * The output color of this effect is a modulation of the input color and a sample from a texture. |
| + * The output color of this effect is a modulation of the input color and the filtered average of |
| + * several samples from a texture. It is based on Justin Novosad's GPU texture filtering code |
| + * from GPU Gems 2. |
| + * |
| * It allows explicit specification of the filtering and wrap modes (GrTextureParams). It can use |
| * local coords, positions, or a custom vertex attribute as input texture coords. The input coords |
| * can have a matrix applied in the VS in both the local and position cases but not with a custom |
| * attribute coords at this time. It will add a varying to input interpolate texture coords to the |
| * FS. |
| */ |
| -class GrSimpleTextureEffect : public GrSingleTextureEffect { |
| +class GrHQScaleTextureEffect : public GrSingleTextureEffect { |
| public: |
| /* unfiltered, clamp mode */ |
| static GrEffectRef* Create(GrTexture* tex, |
| const SkMatrix& matrix, |
| CoordsType coordsType = kLocal_CoordsType) { |
| SkASSERT(kLocal_CoordsType == coordsType || kPosition_CoordsType == coordsType); |
| - AutoEffectUnref effect(SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, GrTextureParams::kNone_FilterMode, coordsType))); |
| + AutoEffectUnref effect(SkNEW_ARGS(GrHQScaleTextureEffect, (tex, matrix, GrTextureParams::kNone_FilterMode, coordsType))); |
| return CreateEffectRef(effect); |
| } |
| @@ -38,7 +41,7 @@ public: |
| CoordsType coordsType = kLocal_CoordsType) { |
| SkASSERT(kLocal_CoordsType == coordsType || kPosition_CoordsType == coordsType); |
| AutoEffectUnref effect( |
| - SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, filterMode, coordsType))); |
| + SkNEW_ARGS(GrHQScaleTextureEffect, (tex, matrix, filterMode, coordsType))); |
| return CreateEffectRef(effect); |
| } |
| @@ -47,32 +50,32 @@ public: |
| const GrTextureParams& p, |
| CoordsType coordsType = kLocal_CoordsType) { |
| SkASSERT(kLocal_CoordsType == coordsType || kPosition_CoordsType == coordsType); |
| - AutoEffectUnref effect(SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p, coordsType))); |
| + AutoEffectUnref effect(SkNEW_ARGS(GrHQScaleTextureEffect, (tex, matrix, p, coordsType))); |
| return CreateEffectRef(effect); |
| } |
| /** Variant that requires the client to install a custom kVec2 vertex attribute that will be |
| the source of the coords. No matrix is allowed in this mode. */ |
| static GrEffectRef* CreateWithCustomCoords(GrTexture* tex, const GrTextureParams& p) { |
| - AutoEffectUnref effect(SkNEW_ARGS(GrSimpleTextureEffect, (tex, |
| + AutoEffectUnref effect(SkNEW_ARGS(GrHQScaleTextureEffect, (tex, |
| SkMatrix::I(), |
| p, |
| kCustom_CoordsType))); |
| return CreateEffectRef(effect); |
| } |
| - virtual ~GrSimpleTextureEffect() {} |
| + virtual ~GrHQScaleTextureEffect() {} |
| - static const char* Name() { return "Texture"; } |
| + static const char* Name() { return "ScaledTexture"; } |
| virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; |
| - typedef GrGLSimpleTextureEffect GLEffect; |
| + typedef GrGLHQScaleTextureEffect GLEffect; |
| virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
| private: |
| - GrSimpleTextureEffect(GrTexture* texture, |
| + GrHQScaleTextureEffect(GrTexture* texture, |
| const SkMatrix& matrix, |
| GrTextureParams::FilterMode filterMode, |
| CoordsType coordsType) |
| @@ -80,7 +83,7 @@ private: |
| SkASSERT(kLocal_CoordsType == coordsType || kPosition_CoordsType == coordsType); |
| } |
| - GrSimpleTextureEffect(GrTexture* texture, |
| + GrHQScaleTextureEffect(GrTexture* texture, |
| const SkMatrix& matrix, |
| const GrTextureParams& params, |
| CoordsType coordsType) |
| @@ -92,7 +95,7 @@ private: |
| } |
| virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { |
| - const GrSimpleTextureEffect& ste = CastEffect<GrSimpleTextureEffect>(other); |
| + const GrHQScaleTextureEffect& ste = CastEffect<GrHQScaleTextureEffect>(other); |
| return this->hasSameTextureParamsMatrixAndCoordsType(ste); |
| } |