OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 GrGLEffectMatrix_DEFINED | 8 #ifndef GrGLEffectMatrix_DEFINED |
9 #define GrGLEffectMatrix_DEFINED | 9 #define GrGLEffectMatrix_DEFINED |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 * The matrix uses kKeyBits of the effect's EffectKey. A GrGLEffect may plac
e these bits at an | 52 * The matrix uses kKeyBits of the effect's EffectKey. A GrGLEffect may plac
e these bits at an |
53 * arbitrary shift in its final key. However, when GrGLEffectMatrix::emitCod
e*() code is called | 53 * arbitrary shift in its final key. However, when GrGLEffectMatrix::emitCod
e*() code is called |
54 * the relevant bits must be in the lower kKeyBits of the key parameter. | 54 * the relevant bits must be in the lower kKeyBits of the key parameter. |
55 */ | 55 */ |
56 enum { | 56 enum { |
57 kKeyBits = kKeyBitsPrivate, | 57 kKeyBits = kKeyBitsPrivate, |
58 kKeyMask = (1 << kKeyBits) - 1, | 58 kKeyMask = (1 << kKeyBits) - 1, |
59 }; | 59 }; |
60 | 60 |
61 GrGLEffectMatrix(CoordsType coordsType) | 61 GrGLEffectMatrix(CoordsType coordsType) |
62 : fUni(GrGLUniformManager::kInvalidUniformHandle) | 62 : fUni(NULL) |
63 , fCoordsType(coordsType) { | 63 , fCoordsType(coordsType) { |
64 GrAssert(GrEffect::kLocal_CoordsType == coordsType || | 64 GrAssert(GrEffect::kLocal_CoordsType == coordsType || |
65 GrEffect::kPosition_CoordsType == coordsType); | 65 GrEffect::kPosition_CoordsType == coordsType); |
66 fPrevMatrix = SkMatrix::InvalidMatrix(); | 66 fPrevMatrix = SkMatrix::InvalidMatrix(); |
67 } | 67 } |
68 | 68 |
69 /** | 69 /** |
70 * Generates the key for the portion of the code emitted by this class's emi
tCode() function. | 70 * Generates the key for the portion of the code emitted by this class's emi
tCode() function. |
71 * Pass a texture to make GrGLEffectMatrix automatically adjust for the text
ure's origin. Pass | 71 * Pass a texture to make GrGLEffectMatrix automatically adjust for the text
ure's origin. Pass |
72 * NULL when not using the EffectMatrix for a texture lookup, or if the GrGL
Effect subclass | 72 * NULL when not using the EffectMatrix for a texture lookup, or if the GrGL
Effect subclass |
(...skipping 27 matching lines...) Expand all Loading... |
100 void emitCodeMakeFSCoords2D(GrGLShaderBuilder*, | 100 void emitCodeMakeFSCoords2D(GrGLShaderBuilder*, |
101 EffectKey, | 101 EffectKey, |
102 const char** fsCoordName, /* optional */ | 102 const char** fsCoordName, /* optional */ |
103 const char** vsVaryingName = NULL, | 103 const char** vsVaryingName = NULL, |
104 GrSLType* vsVaryingType = NULL, | 104 GrSLType* vsVaryingType = NULL, |
105 const char* suffix = NULL); | 105 const char* suffix = NULL); |
106 /** | 106 /** |
107 * Call from a GrGLEffect's subclass to update the texture matrix. The effec
tMatrix and texture | 107 * Call from a GrGLEffect's subclass to update the texture matrix. The effec
tMatrix and texture |
108 * params should match those used with GenKey. | 108 * params should match those used with GenKey. |
109 */ | 109 */ |
110 void setData(const GrGLUniformManager& uniformManager, | 110 void setData(const GrGLContext& context, |
111 const SkMatrix& effectMatrix, | 111 const SkMatrix& effectMatrix, |
112 const GrDrawEffect& drawEffect, | 112 const GrDrawEffect& drawEffect, |
113 const GrTexture*); | 113 const GrTexture*); |
114 | 114 |
115 GrGLUniformManager::UniformHandle fUni; | 115 GrGLUniform* fUni; |
116 GrSLType fUniType; | 116 GrSLType fUniType; |
117 SkMatrix fPrevMatrix; | 117 SkMatrix fPrevMatrix; |
118 CoordsType fCoordsType; | 118 CoordsType fCoordsType; |
119 }; | 119 }; |
120 | 120 |
121 #endif | 121 #endif |
OLD | NEW |