Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Side by Side Diff: include/gpu/GrDrawEffect.h

Issue 22850006: Replace uses of GrAssert by SkASSERT. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/gpu/GrContext.h ('k') | include/gpu/GrEffect.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 #ifndef GrDrawEffect_DEFINED 2 #ifndef GrDrawEffect_DEFINED
3 #define GrDrawEffect_DEFINED 3 #define GrDrawEffect_DEFINED
4 4
5 #include "GrEffectStage.h" 5 #include "GrEffectStage.h"
6 6
7 /** 7 /**
8 * This class is used to communicate the particular GrEffect used in a draw to t he backend-specific 8 * This class is used to communicate the particular GrEffect used in a draw to t he backend-specific
9 * effect subclass (e.g. GrGLEffect). It is used to by the backend-specific clas s to generate a 9 * effect subclass (e.g. GrGLEffect). It is used to by the backend-specific clas s to generate a
10 * cache key for the effect, generate code on a program cache miss, and to uploa d uniform values to 10 * cache key for the effect, generate code on a program cache miss, and to uploa d uniform values to
11 * the program. 11 * the program.
12 * In addition to the effect, it also communicates any changes between the relat ionship between 12 * In addition to the effect, it also communicates any changes between the relat ionship between
13 * the view matrix and local coordinate system since the effect was installed in its GrDrawState. 13 * the view matrix and local coordinate system since the effect was installed in its GrDrawState.
14 * The typical use case is that sometime after an effect was installed a decisio n was made to draw 14 * The typical use case is that sometime after an effect was installed a decisio n was made to draw
15 * in device coordinates (i.e. use an identity view-matrix). In such a case the GrDrawEffect's 15 * in device coordinates (i.e. use an identity view-matrix). In such a case the GrDrawEffect's
16 * coord-change-matrix would be the inverse of the view matrix that was set when the effect was 16 * coord-change-matrix would be the inverse of the view matrix that was set when the effect was
17 * installed. GrGLEffectMatrix is a handy class that implements a local coordina te matrix that 17 * installed. GrGLEffectMatrix is a handy class that implements a local coordina te matrix that
18 * automatically accounts for the coord-change matrix. 18 * automatically accounts for the coord-change matrix.
19 */ 19 */
20 class GrDrawEffect { 20 class GrDrawEffect {
21 public: 21 public:
22 GrDrawEffect(const GrEffectStage& stage, bool explicitLocalCoords) 22 GrDrawEffect(const GrEffectStage& stage, bool explicitLocalCoords)
23 : fEffectStage(&stage) 23 : fEffectStage(&stage)
24 , fExplicitLocalCoords(explicitLocalCoords) { 24 , fExplicitLocalCoords(explicitLocalCoords) {
25 GrAssert(NULL != fEffectStage); 25 SkASSERT(NULL != fEffectStage);
26 GrAssert(NULL != fEffectStage->getEffect()); 26 SkASSERT(NULL != fEffectStage->getEffect());
27 } 27 }
28 const GrEffectRef* effect() const { return fEffectStage->getEffect(); } 28 const GrEffectRef* effect() const { return fEffectStage->getEffect(); }
29 29
30 template <typename T> 30 template <typename T>
31 const T& castEffect() const { return *static_cast<const T*>(this->effect()-> get()); } 31 const T& castEffect() const { return *static_cast<const T*>(this->effect()-> get()); }
32 32
33 const SkMatrix& getCoordChangeMatrix() const { 33 const SkMatrix& getCoordChangeMatrix() const {
34 if (fExplicitLocalCoords) { 34 if (fExplicitLocalCoords) {
35 return SkMatrix::I(); 35 return SkMatrix::I();
36 } else { 36 } else {
37 return fEffectStage->getCoordChangeMatrix(); 37 return fEffectStage->getCoordChangeMatrix();
38 } 38 }
39 } 39 }
40 40
41 bool programHasExplicitLocalCoords() const { return fExplicitLocalCoords; } 41 bool programHasExplicitLocalCoords() const { return fExplicitLocalCoords; }
42 42
43 const int* getVertexAttribIndices() const { return fEffectStage->getVertexAt tribIndices(); } 43 const int* getVertexAttribIndices() const { return fEffectStage->getVertexAt tribIndices(); }
44 int getVertexAttribIndexCount() const { return fEffectStage->getVertexAttrib IndexCount(); } 44 int getVertexAttribIndexCount() const { return fEffectStage->getVertexAttrib IndexCount(); }
45 45
46 private: 46 private:
47 const GrEffectStage* fEffectStage; 47 const GrEffectStage* fEffectStage;
48 bool fExplicitLocalCoords; 48 bool fExplicitLocalCoords;
49 }; 49 };
50 50
51 #endif 51 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | include/gpu/GrEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698