gfx/skia/trunk/src/gpu/effects/GrSingleTextureEffect.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.

     1 /*
     2  * Copyright 2012 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  */
     8 #ifndef GrSingleTextureEffect_DEFINED
     9 #define GrSingleTextureEffect_DEFINED
    11 #include "GrEffect.h"
    12 #include "SkMatrix.h"
    13 #include "GrCoordTransform.h"
    15 class GrTexture;
    17 /**
    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.
    20  */
    21 class GrSingleTextureEffect : public GrEffect {
    22 public:
    23     virtual ~GrSingleTextureEffect();
    25 protected:
    26     /** unfiltered, clamp mode */
    27     GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrCoordSet = kLocal_GrCoordSet);
    28     /** clamp mode */
    29     GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrTextureParams::FilterMode filterMode,
    30                           GrCoordSet = kLocal_GrCoordSet);
    31     GrSingleTextureEffect(GrTexture*,
    32                           const SkMatrix&,
    33                           const GrTextureParams&,
    34                           GrCoordSet = kLocal_GrCoordSet);
    36     /**
    37      * Helper for subclass onIsEqual() functions.
    38      */
    39     bool hasSameTextureParamsMatrixAndSourceCoords(const GrSingleTextureEffect& other) const {
    40         // We don't have to check the accesses' swizzles because they are inferred from the texture.
    41         return fTextureAccess == other.fTextureAccess &&
    42                fCoordTransform.getMatrix().cheapEqualTo(other.fCoordTransform.getMatrix()) &&
    43                fCoordTransform.sourceCoords() == other.fCoordTransform.sourceCoords();
    44     }
    46     /**
    47      * Can be used as a helper to implement subclass getConstantColorComponents(). It assumes that
    48      * the subclass output color will be a modulation of the input color with a value read from the
    49      * texture.
    50      */
    51     void updateConstantColorComponentsForModulation(GrColor* color, uint32_t* validFlags) const {
    52         if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*color) &&
    53             GrPixelConfigIsOpaque(this->texture(0)->config())) {
    54             *validFlags = kA_GrColorComponentFlag;
    55         } else {
    56             *validFlags = 0;
    57         }
    58     }
    60 private:
    61     GrCoordTransform fCoordTransform;
    62     GrTextureAccess  fTextureAccess;
    64     typedef GrEffect INHERITED;
    65 };
    67 #endif

mercurial