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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 GrGLuint genPaths(GrGLsizei range); | 59 GrGLuint genPaths(GrGLsizei range); |
60 GrGLvoid deletePaths(GrGLuint path, GrGLsizei range); | 60 GrGLvoid deletePaths(GrGLuint path, GrGLsizei range); |
61 | 61 |
62 protected: | 62 protected: |
63 void onStencilPath(const StencilPathArgs&, const GrPath*) override; | 63 void onStencilPath(const StencilPathArgs&, const GrPath*) override; |
64 void onDrawPath(const DrawPathArgs&, const GrPath*) override; | 64 void onDrawPath(const DrawPathArgs&, const GrPath*) override; |
65 void onDrawPaths(const DrawPathArgs&, const GrPathRange*, const void* indice
s, PathIndexType, | 65 void onDrawPaths(const DrawPathArgs&, const GrPathRange*, const void* indice
s, PathIndexType, |
66 const float transformValues[], PathTransformType, int count
) override; | 66 const float transformValues[], PathTransformType, int count
) override; |
67 private: | 67 private: |
| 68 /** |
| 69 * Mark certain functionality as not supported if the driver version is too |
| 70 * old and a backup implementation is not practical. |
| 71 */ |
| 72 struct Caps { |
| 73 bool stencilThenCoverSupport : 1; |
| 74 bool fragmentInputGenSupport : 1; |
| 75 }; |
| 76 const Caps& caps() const { return fCaps; } |
| 77 |
68 void flushPathStencilSettings(const GrStencilSettings&); | 78 void flushPathStencilSettings(const GrStencilSettings&); |
69 | 79 |
| 80 // NV_path_rendering v1.2 |
| 81 void stencilThenCoverFillPath(GrGLuint path, GrGLenum fillMode, |
| 82 GrGLuint mask, GrGLenum coverMode); |
| 83 |
| 84 void stencilThenCoverStrokePath(GrGLuint path, GrGLint reference, |
| 85 GrGLuint mask, GrGLenum coverMode); |
| 86 |
| 87 void stencilThenCoverFillPathInstanced( |
| 88 GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, |
| 89 GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, Gr
GLenum coverMode, |
| 90 GrGLenum transformType, const GrGLfloat *transformValue
s); |
| 91 |
| 92 void stencilThenCoverStrokePathInstanced( |
| 93 GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvo
id *paths, |
| 94 GrGLuint pathBase, GrGLint reference, GrGLuint mask, Gr
GLenum coverMode, |
| 95 GrGLenum transformType, const GrGLfloat *transformValue
s); |
| 96 |
70 struct MatrixState { | 97 struct MatrixState { |
71 SkMatrix fViewMatrix; | 98 SkMatrix fViewMatrix; |
72 SkISize fRenderTargetSize; | 99 SkISize fRenderTargetSize; |
73 GrSurfaceOrigin fRenderTargetOrigin; | 100 GrSurfaceOrigin fRenderTargetOrigin; |
74 | 101 |
75 MatrixState() { this->invalidate(); } | 102 MatrixState() { this->invalidate(); } |
76 void invalidate() { | 103 void invalidate() { |
77 fViewMatrix = SkMatrix::InvalidMatrix(); | 104 fViewMatrix = SkMatrix::InvalidMatrix(); |
78 fRenderTargetSize.fWidth = -1; | 105 fRenderTargetSize.fWidth = -1; |
79 fRenderTargetSize.fHeight = -1; | 106 fRenderTargetSize.fHeight = -1; |
(...skipping 14 matching lines...) Expand all Loading... |
94 0, SkIntToScalar(2) / fRenderTargetSize.fHeight,
-SK_Scalar1, | 121 0, SkIntToScalar(2) / fRenderTargetSize.fHeight,
-SK_Scalar1, |
95 0, 0, 1); | 122 0, 0, 1); |
96 } | 123 } |
97 combined.preConcat(fViewMatrix); | 124 combined.preConcat(fViewMatrix); |
98 GrGLGetMatrix<Size>(destMatrix, combined); | 125 GrGLGetMatrix<Size>(destMatrix, combined); |
99 } | 126 } |
100 }; | 127 }; |
101 GrGLGpu* gpu(); | 128 GrGLGpu* gpu(); |
102 | 129 |
103 SkAutoTDelete<GrGLNameAllocator> fPathNameAllocator; | 130 SkAutoTDelete<GrGLNameAllocator> fPathNameAllocator; |
| 131 Caps fCaps; |
104 MatrixState fHWProjectionMatrixState; | 132 MatrixState fHWProjectionMatrixState; |
105 GrStencilSettings fHWPathStencilSettings; | 133 GrStencilSettings fHWPathStencilSettings; |
| 134 struct PathTexGenData { |
| 135 GrGLenum fMode; |
| 136 GrGLint fNumComponents; |
| 137 GrGLfloat fCoefficients[3 * 3]; |
| 138 }; |
106 }; | 139 }; |
107 | 140 |
108 #endif | 141 #endif |
OLD | NEW |