| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 8 |
| 9 #ifndef GrGLProgram_DEFINED | 9 #ifndef GrGLProgram_DEFINED |
| 10 #define GrGLProgram_DEFINED | 10 #define GrGLProgram_DEFINED |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 SkISize fRenderTargetSize; | 93 SkISize fRenderTargetSize; |
| 94 GrSurfaceOrigin fRenderTargetOrigin; | 94 GrSurfaceOrigin fRenderTargetOrigin; |
| 95 | 95 |
| 96 MatrixState() { this->invalidate(); } | 96 MatrixState() { this->invalidate(); } |
| 97 void invalidate() { | 97 void invalidate() { |
| 98 fViewMatrix = SkMatrix::InvalidMatrix(); | 98 fViewMatrix = SkMatrix::InvalidMatrix(); |
| 99 fRenderTargetSize.fWidth = -1; | 99 fRenderTargetSize.fWidth = -1; |
| 100 fRenderTargetSize.fHeight = -1; | 100 fRenderTargetSize.fHeight = -1; |
| 101 fRenderTargetOrigin = (GrSurfaceOrigin) -1; | 101 fRenderTargetOrigin = (GrSurfaceOrigin) -1; |
| 102 } | 102 } |
| 103 template<int Size> void getGLMatrix(GrGLfloat* destMatrix) { |
| 104 SkMatrix combined; |
| 105 if (kBottomLeft_GrSurfaceOrigin == fRenderTargetOrigin) { |
| 106 combined.setAll(SkIntToScalar(2) / fRenderTargetSize.fWidth, 0,
-SK_Scalar1, |
| 107 0, -SkIntToScalar(2) / fRenderTargetSize.fHeight
, SK_Scalar1, |
| 108 0, 0, SkMatrix::I()[8]); |
| 109 } else { |
| 110 combined.setAll(SkIntToScalar(2) / fRenderTargetSize.fWidth, 0,
-SK_Scalar1, |
| 111 0, SkIntToScalar(2) / fRenderTargetSize.fHeight,
-SK_Scalar1, |
| 112 0, 0, SkMatrix::I()[8]); |
| 113 } |
| 114 combined.setConcat(combined, fViewMatrix); |
| 115 GrGLGetMatrix<Size>(destMatrix, combined); |
| 116 } |
| 103 }; | 117 }; |
| 104 | 118 |
| 105 /** | 119 /** |
| 106 * This function uploads uniforms and calls each GrGLEffect's setData. It is
called before a | 120 * This function uploads uniforms and calls each GrGLEffect's setData. It is
called before a |
| 107 * draw occurs using the program after the program has already been bound. I
t also uses the | 121 * draw occurs using the program after the program has already been bound. I
t also uses the |
| 108 * GrGpuGL object to bind the textures required by the GrGLEffects. The colo
r and coverage | 122 * GrGpuGL object to bind the textures required by the GrGLEffects. The colo
r and coverage |
| 109 * stages come from GrGLProgramDesc::Build(). | 123 * stages come from GrGLProgramDesc::Build(). |
| 110 */ | 124 */ |
| 111 void setData(GrDrawState::BlendOptFlags, | 125 void setData(GrDrawState::BlendOptFlags, |
| 112 const GrEffectStage* colorStages[], | 126 const GrEffectStage* colorStages[], |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 GrGLProgramDesc fDesc; | 224 GrGLProgramDesc fDesc; |
| 211 GrGpuGL* fGpu; | 225 GrGpuGL* fGpu; |
| 212 | 226 |
| 213 GrGLUniformManager fUniformManager; | 227 GrGLUniformManager fUniformManager; |
| 214 UniformHandles fUniformHandles; | 228 UniformHandles fUniformHandles; |
| 215 | 229 |
| 216 typedef GrRefCnt INHERITED; | 230 typedef GrRefCnt INHERITED; |
| 217 }; | 231 }; |
| 218 | 232 |
| 219 #endif | 233 #endif |
| OLD | NEW |