OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrGLPathRendering_DEFINED | 8 #ifndef GrGLPathRendering_DEFINED |
9 #define GrGLPathRendering_DEFINED | 9 #define GrGLPathRendering_DEFINED |
10 | 10 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 void stencilThenCoverFillPathInstanced( | 119 void stencilThenCoverFillPathInstanced( |
120 GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, | 120 GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, |
121 GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, Gr
GLenum coverMode, | 121 GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, Gr
GLenum coverMode, |
122 GrGLenum transformType, const GrGLfloat *transformValue
s); | 122 GrGLenum transformType, const GrGLfloat *transformValue
s); |
123 | 123 |
124 void stencilThenCoverStrokePathInstanced( | 124 void stencilThenCoverStrokePathInstanced( |
125 GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvo
id *paths, | 125 GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvo
id *paths, |
126 GrGLuint pathBase, GrGLint reference, GrGLuint mask, Gr
GLenum coverMode, | 126 GrGLuint pathBase, GrGLint reference, GrGLuint mask, Gr
GLenum coverMode, |
127 GrGLenum transformType, const GrGLfloat *transformValue
s); | 127 GrGLenum transformType, const GrGLfloat *transformValue
s); |
128 | 128 |
| 129 struct MatrixState { |
| 130 SkMatrix fViewMatrix; |
| 131 SkISize fRenderTargetSize; |
| 132 GrSurfaceOrigin fRenderTargetOrigin; |
| 133 |
| 134 MatrixState() { this->invalidate(); } |
| 135 void invalidate() { |
| 136 fViewMatrix = SkMatrix::InvalidMatrix(); |
| 137 fRenderTargetSize.fWidth = -1; |
| 138 fRenderTargetSize.fHeight = -1; |
| 139 fRenderTargetOrigin = (GrSurfaceOrigin) -1; |
| 140 } |
| 141 |
| 142 /** |
| 143 * Gets a matrix that goes from local coordinates to GL normalized devic
e coords. |
| 144 */ |
| 145 template<int Size> void getRTAdjustedGLMatrix(GrGLfloat* destMatrix) { |
| 146 SkMatrix combined; |
| 147 if (kBottomLeft_GrSurfaceOrigin == fRenderTargetOrigin) { |
| 148 combined.setAll(SkIntToScalar(2) / fRenderTargetSize.fWidth, 0,
-SK_Scalar1, |
| 149 0, -SkIntToScalar(2) / fRenderTargetSize.fHeight
, SK_Scalar1, |
| 150 0, 0, 1); |
| 151 } else { |
| 152 combined.setAll(SkIntToScalar(2) / fRenderTargetSize.fWidth, 0,
-SK_Scalar1, |
| 153 0, SkIntToScalar(2) / fRenderTargetSize.fHeight,
-SK_Scalar1, |
| 154 0, 0, 1); |
| 155 } |
| 156 combined.preConcat(fViewMatrix); |
| 157 GrGLGetMatrix<Size>(destMatrix, combined); |
| 158 } |
| 159 }; |
| 160 |
129 GrGLGpu* fGpu; | 161 GrGLGpu* fGpu; |
130 SkAutoTDelete<GrGLNameAllocator> fPathNameAllocator; | 162 SkAutoTDelete<GrGLNameAllocator> fPathNameAllocator; |
131 Caps fCaps; | 163 Caps fCaps; |
132 GrGLProgram::MatrixState fHWProjectionMatrixState; | 164 MatrixState fHWProjectionMatrixState; |
133 GrStencilSettings fHWPathStencilSettings; | 165 GrStencilSettings fHWPathStencilSettings; |
134 struct PathTexGenData { | 166 struct PathTexGenData { |
135 GrGLenum fMode; | 167 GrGLenum fMode; |
136 GrGLint fNumComponents; | 168 GrGLint fNumComponents; |
137 GrGLfloat fCoefficients[3 * 3]; | 169 GrGLfloat fCoefficients[3 * 3]; |
138 }; | 170 }; |
139 int fHWActivePathTexGenSets; | 171 int fHWActivePathTexGenSets; |
140 SkTArray<PathTexGenData, true> fHWPathTexGenSettings; | 172 SkTArray<PathTexGenData, true> fHWPathTexGenSettings; |
141 }; | 173 }; |
142 | 174 |
143 #endif | 175 #endif |
OLD | NEW |