Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 | 10 |
| 11 #ifndef GrEffectStage_DEFINED | 11 #ifndef GrEffectStage_DEFINED |
| 12 #define GrEffectStage_DEFINED | 12 #define GrEffectStage_DEFINED |
| 13 | 13 |
| 14 #include "GrBackendEffectFactory.h" | 14 #include "GrBackendEffectFactory.h" |
| 15 #include "GrEffect.h" | 15 #include "GrEffect.h" |
| 16 #include "SkMatrix.h" | 16 #include "SkMatrix.h" |
| 17 #include "GrTypes.h" | 17 #include "GrTypes.h" |
| 18 | 18 |
| 19 #include "SkShader.h" | 19 #include "SkShader.h" |
| 20 | 20 |
| 21 class GrEffectStage { | 21 class GrEffectStage : public SkRefCnt { |
| 22 public: | 22 public: |
| 23 SK_DECLARE_INST_COUNT(GrEffectStage); | |
| 24 | |
| 23 explicit GrEffectStage(const GrEffect* effect, int attrIndex0 = -1, int attr Index1 = -1) | 25 explicit GrEffectStage(const GrEffect* effect, int attrIndex0 = -1, int attr Index1 = -1) |
| 24 : fEffect(SkRef(effect)) { | 26 : fEffect(SkRef(effect)) { |
| 25 fCoordChangeMatrixSet = false; | 27 fCoordChangeMatrixSet = false; |
| 26 fVertexAttribIndices[0] = attrIndex0; | 28 fVertexAttribIndices[0] = attrIndex0; |
| 27 fVertexAttribIndices[1] = attrIndex1; | 29 fVertexAttribIndices[1] = attrIndex1; |
| 28 } | 30 } |
| 29 | 31 |
|
robertphillips
2014/08/29 15:04:53
We don't usually add the explicit empty INHERITED(
joshua.litt
2014/09/02 16:06:21
Well, if I don't do this then I get a warning on m
| |
| 30 GrEffectStage(const GrEffectStage& other) { | 32 GrEffectStage(const GrEffectStage& other) : INHERITED() { |
|
bsalomon
2014/08/29 15:07:25
We don't require explicit calls of default cons fo
joshua.litt
2014/09/02 16:06:21
see above
| |
| 31 *this = other; | 33 *this = other; |
| 32 } | 34 } |
| 33 | 35 |
| 34 GrEffectStage& operator= (const GrEffectStage& other) { | 36 GrEffectStage& operator= (const GrEffectStage& other) { |
| 35 fCoordChangeMatrixSet = other.fCoordChangeMatrixSet; | 37 fCoordChangeMatrixSet = other.fCoordChangeMatrixSet; |
| 36 if (other.fCoordChangeMatrixSet) { | 38 if (other.fCoordChangeMatrixSet) { |
| 37 fCoordChangeMatrix = other.fCoordChangeMatrix; | 39 fCoordChangeMatrix = other.fCoordChangeMatrix; |
| 38 } | 40 } |
| 39 fEffect.reset(SkRef(other.fEffect.get())); | 41 fEffect.reset(SkRef(other.fEffect.get())); |
| 40 memcpy(fVertexAttribIndices, other.fVertexAttribIndices, sizeof(fVertexA ttribIndices)); | 42 memcpy(fVertexAttribIndices, other.fVertexAttribIndices, sizeof(fVertexA ttribIndices)); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 const GrEffect* getEffect() const { return fEffect.get(); } | 136 const GrEffect* getEffect() const { return fEffect.get(); } |
| 135 | 137 |
| 136 const int* getVertexAttribIndices() const { return fVertexAttribIndices; } | 138 const int* getVertexAttribIndices() const { return fVertexAttribIndices; } |
| 137 int getVertexAttribIndexCount() const { return fEffect->numVertexAttribs(); } | 139 int getVertexAttribIndexCount() const { return fEffect->numVertexAttribs(); } |
| 138 | 140 |
| 139 private: | 141 private: |
| 140 bool fCoordChangeMatrixSet; | 142 bool fCoordChangeMatrixSet; |
| 141 SkMatrix fCoordChangeMatrix; | 143 SkMatrix fCoordChangeMatrix; |
| 142 SkAutoTUnref<const GrEffect> fEffect; | 144 SkAutoTUnref<const GrEffect> fEffect; |
| 143 int fVertexAttribIndices[2]; | 145 int fVertexAttribIndices[2]; |
| 146 | |
| 147 typedef SkRefCnt INHERITED; | |
| 144 }; | 148 }; |
| 145 | 149 |
| 146 #endif | 150 #endif |
| OLD | NEW |