| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrGLPrimitiveProcessor_DEFINED | 8 #ifndef GrGLPrimitiveProcessor_DEFINED |
| 9 #define GrGLPrimitiveProcessor_DEFINED | 9 #define GrGLPrimitiveProcessor_DEFINED |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 GrPrimitiveProcessor parameter is guaranteed to be of the same type that
created this | 65 GrPrimitiveProcessor parameter is guaranteed to be of the same type that
created this |
| 66 GrGLPrimitiveProcessor and to have an identical processor key as the one
that created this | 66 GrGLPrimitiveProcessor and to have an identical processor key as the one
that created this |
| 67 GrGLPrimitiveProcessor. */ | 67 GrGLPrimitiveProcessor. */ |
| 68 virtual void setData(const GrGLProgramDataManager&, const GrPrimitiveProcess
or&) = 0; | 68 virtual void setData(const GrGLProgramDataManager&, const GrPrimitiveProcess
or&) = 0; |
| 69 | 69 |
| 70 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor
dTransform&); | 70 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor
dTransform&); |
| 71 | 71 |
| 72 protected: | 72 protected: |
| 73 void setupUniformColor(GrGLGPBuilder* pb, const char* outputName, UniformHan
dle* colorUniform); | 73 void setupUniformColor(GrGLGPBuilder* pb, const char* outputName, UniformHan
dle* colorUniform); |
| 74 | 74 |
| 75 class ShaderVarHandle { | |
| 76 public: | |
| 77 bool isValid() const { return fHandle > -1; } | |
| 78 ShaderVarHandle() : fHandle(-1) {} | |
| 79 ShaderVarHandle(int value) : fHandle(value) { SkASSERT(this->isValid());
} | |
| 80 int handle() const { SkASSERT(this->isValid()); return fHandle; } | |
| 81 UniformHandle convertToUniformHandle() { | |
| 82 SkASSERT(this->isValid()); | |
| 83 return GrGLProgramDataManager::UniformHandle::CreateFromUniformIndex
(fHandle); | |
| 84 } | |
| 85 SeparableVaryingHandle convertToSeparableVaryingHandle() { | |
| 86 SkASSERT(this->isValid()); | |
| 87 return SeparableVaryingHandle::CreateFromSeparableVaryingIndex(fHand
le); | |
| 88 } | |
| 89 | |
| 90 private: | |
| 91 int fHandle; | |
| 92 }; | |
| 93 | |
| 94 struct Transform { | 75 struct Transform { |
| 95 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM
atrix(); } | 76 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM
atrix(); } |
| 96 ShaderVarHandle fHandle; | 77 GrGLProgramDataManager::UniformHandle fHandle; |
| 97 SkMatrix fCurrentValue; | 78 SkMatrix fCurrentValue; |
| 98 GrSLType fType; | 79 GrSLType fType; |
| 99 }; | 80 }; |
| 100 | 81 |
| 101 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms; | 82 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms; |
| 102 }; | 83 }; |
| 103 | 84 |
| 104 #endif | 85 #endif |
| OLD | NEW |