gfx/skia/trunk/src/gpu/effects/GrSimpleTextureEffect.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /*
michael@0 2 * Copyright 2013 Google Inc.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license that can be
michael@0 5 * found in the LICENSE file.
michael@0 6 */
michael@0 7
michael@0 8 #ifndef GrSimpleTextureEffect_DEFINED
michael@0 9 #define GrSimpleTextureEffect_DEFINED
michael@0 10
michael@0 11 #include "GrSingleTextureEffect.h"
michael@0 12
michael@0 13 class GrGLSimpleTextureEffect;
michael@0 14
michael@0 15 /**
michael@0 16 * The output color of this effect is a modulation of the input color and a sample from a texture.
michael@0 17 * It allows explicit specification of the filtering and wrap modes (GrTextureParams). It can use
michael@0 18 * local coords, positions, or a custom vertex attribute as input texture coords. The input coords
michael@0 19 * can have a matrix applied in the VS in both the local and position cases but not with a custom
michael@0 20 * attribute coords at this time. It will add a varying to input interpolate texture coords to the
michael@0 21 * FS.
michael@0 22 */
michael@0 23 class GrSimpleTextureEffect : public GrSingleTextureEffect {
michael@0 24 public:
michael@0 25 /* unfiltered, clamp mode */
michael@0 26 static GrEffectRef* Create(GrTexture* tex,
michael@0 27 const SkMatrix& matrix,
michael@0 28 GrCoordSet coordSet = kLocal_GrCoordSet) {
michael@0 29 AutoEffectUnref effect(SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, GrTextureParams::kNone_FilterMode, coordSet)));
michael@0 30 return CreateEffectRef(effect);
michael@0 31 }
michael@0 32
michael@0 33 /* clamp mode */
michael@0 34 static GrEffectRef* Create(GrTexture* tex,
michael@0 35 const SkMatrix& matrix,
michael@0 36 GrTextureParams::FilterMode filterMode,
michael@0 37 GrCoordSet coordSet = kLocal_GrCoordSet) {
michael@0 38 AutoEffectUnref effect(
michael@0 39 SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, filterMode, coordSet)));
michael@0 40 return CreateEffectRef(effect);
michael@0 41 }
michael@0 42
michael@0 43 static GrEffectRef* Create(GrTexture* tex,
michael@0 44 const SkMatrix& matrix,
michael@0 45 const GrTextureParams& p,
michael@0 46 GrCoordSet coordSet = kLocal_GrCoordSet) {
michael@0 47 AutoEffectUnref effect(SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p, coordSet)));
michael@0 48 return CreateEffectRef(effect);
michael@0 49 }
michael@0 50
michael@0 51 virtual ~GrSimpleTextureEffect() {}
michael@0 52
michael@0 53 static const char* Name() { return "Texture"; }
michael@0 54
michael@0 55 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
michael@0 56
michael@0 57 typedef GrGLSimpleTextureEffect GLEffect;
michael@0 58
michael@0 59 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
michael@0 60
michael@0 61 private:
michael@0 62 GrSimpleTextureEffect(GrTexture* texture,
michael@0 63 const SkMatrix& matrix,
michael@0 64 GrTextureParams::FilterMode filterMode,
michael@0 65 GrCoordSet coordSet)
michael@0 66 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) {
michael@0 67 }
michael@0 68
michael@0 69 GrSimpleTextureEffect(GrTexture* texture,
michael@0 70 const SkMatrix& matrix,
michael@0 71 const GrTextureParams& params,
michael@0 72 GrCoordSet coordSet)
michael@0 73 : GrSingleTextureEffect(texture, matrix, params, coordSet) {
michael@0 74 }
michael@0 75
michael@0 76 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
michael@0 77 const GrSimpleTextureEffect& ste = CastEffect<GrSimpleTextureEffect>(other);
michael@0 78 return this->hasSameTextureParamsMatrixAndSourceCoords(ste);
michael@0 79 }
michael@0 80
michael@0 81 GR_DECLARE_EFFECT_TEST;
michael@0 82
michael@0 83 typedef GrSingleTextureEffect INHERITED;
michael@0 84 };
michael@0 85
michael@0 86 #endif

mercurial