gfx/skia/trunk/include/gpu/GrDrawEffect.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 #ifndef GrDrawEffect_DEFINED
michael@0 3 #define GrDrawEffect_DEFINED
michael@0 4
michael@0 5 #include "GrEffectStage.h"
michael@0 6
michael@0 7 /**
michael@0 8 * This class is used to communicate the particular GrEffect used in a draw to the backend-specific
michael@0 9 * effect subclass (e.g. GrGLEffect). It is used to by the backend-specific class to generate a
michael@0 10 * cache key for the effect, generate code on a program cache miss, and to upload uniform values to
michael@0 11 * the program.
michael@0 12 * In addition to the effect, it also communicates any changes between the relationship between
michael@0 13 * the view matrix and local coordinate system since the effect was installed in its GrDrawState.
michael@0 14 * The typical use case is that sometime after an effect was installed a decision was made to draw
michael@0 15 * in device coordinates (i.e. use an identity view-matrix). In such a case the GrDrawEffect's
michael@0 16 * coord-change-matrix would be the inverse of the view matrix that was set when the effect was
michael@0 17 * installed.
michael@0 18 */
michael@0 19 class GrDrawEffect {
michael@0 20 public:
michael@0 21 GrDrawEffect(const GrEffectStage& stage, bool explicitLocalCoords)
michael@0 22 : fEffectStage(&stage)
michael@0 23 , fExplicitLocalCoords(explicitLocalCoords) {
michael@0 24 SkASSERT(NULL != fEffectStage);
michael@0 25 SkASSERT(NULL != fEffectStage->getEffect());
michael@0 26 }
michael@0 27 const GrEffectRef* effect() const { return fEffectStage->getEffect(); }
michael@0 28
michael@0 29 template <typename T>
michael@0 30 const T& castEffect() const { return *static_cast<const T*>(this->effect()->get()); }
michael@0 31
michael@0 32 const SkMatrix& getCoordChangeMatrix() const {
michael@0 33 if (fExplicitLocalCoords) {
michael@0 34 return SkMatrix::I();
michael@0 35 } else {
michael@0 36 return fEffectStage->getCoordChangeMatrix();
michael@0 37 }
michael@0 38 }
michael@0 39
michael@0 40 bool programHasExplicitLocalCoords() const { return fExplicitLocalCoords; }
michael@0 41
michael@0 42 const int* getVertexAttribIndices() const { return fEffectStage->getVertexAttribIndices(); }
michael@0 43 int getVertexAttribIndexCount() const { return fEffectStage->getVertexAttribIndexCount(); }
michael@0 44
michael@0 45 private:
michael@0 46 const GrEffectStage* fEffectStage;
michael@0 47 bool fExplicitLocalCoords;
michael@0 48 };
michael@0 49
michael@0 50 #endif

mercurial