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

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

Issue 571163002: removing GrDrawEffect (Closed) Base URL: https://skia.googlesource.com/skia.git@gp3
Patch Set: rebase after revert Created 6 years, 3 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
« no previous file with comments | « include/gpu/GrBackendEffectFactory.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
(Empty)
1
2 #ifndef GrDrawEffect_DEFINED
3 #define GrDrawEffect_DEFINED
4
5 #include "GrEffectStage.h"
6
7 /**
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
10 * cache key for the effect, generate code on a program cache miss, and to uploa d uniform values to
11 * the program.
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.
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
16 * coord-change-matrix would be the inverse of the view matrix that was set when the effect was
17 * installed.
18 */
19 class GrDrawEffect {
20 public:
21 GrDrawEffect(const GrEffectStage& stage, bool explicitLocalCoords)
22 : fEffectStage(&stage)
23 , fExplicitLocalCoords(explicitLocalCoords) {
24 SkASSERT(fEffectStage);
25 SkASSERT(fEffectStage->getEffect());
26 }
27 const GrEffect* effect() const { return fEffectStage->getEffect(); }
28
29 template <typename T>
30 const T& castEffect() const { return *static_cast<const T*>(this->effect()); }
31
32 const SkMatrix& getCoordChangeMatrix() const {
33 if (fExplicitLocalCoords) {
34 return SkMatrix::I();
35 } else {
36 return fEffectStage->getCoordChangeMatrix();
37 }
38 }
39
40 bool programHasExplicitLocalCoords() const { return fExplicitLocalCoords; }
41
42 private:
43 const GrEffectStage* fEffectStage;
44 bool fExplicitLocalCoords;
45 };
46
47 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrBackendEffectFactory.h ('k') | include/gpu/GrEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698