2 * Copyright 2012 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef GrSingleTextureEffect_DEFINED
9 #define GrSingleTextureEffect_DEFINED
11 #include "GrFragmentProcessor.h"
13 #include "GrCoordTransform.h"
18 * A base class for effects that draw a single texture with a texture matrix. This effect has no
19 * backend implementations. One must be provided by the subclass.
21 class GrSingleTextureEffect : public GrFragmentProcessor {
23 virtual ~GrSingleTextureEffect();
26 /** unfiltered, clamp mode */
27 GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrCoordSet = kLocal_GrCoordSet);
29 GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrTextureParams::FilterMode filterMode,
30 GrCoordSet = kLocal_GrCoordSet);
31 GrSingleTextureEffect(GrTexture*,
33 const GrTextureParams&,
34 GrCoordSet = kLocal_GrCoordSet);
37 * Can be used as a helper to implement subclass onComputeInvariantOutput(). It assumes that
38 * the subclass output color will be a modulation of the input color with a value read from the
41 void updateInvariantOutputForModulation(InvariantOutput* inout) const {
42 if (GrPixelConfigIsOpaque(this->texture(0)->config())) {
43 inout->mulByUnknownOpaqueColor();
45 inout->mulByUnknownColor();
50 GrCoordTransform fCoordTransform;
51 GrTextureAccess fTextureAccess;
53 typedef GrFragmentProcessor INHERITED;