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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 /* Called when the 3D context state is unknown. */ | 40 /* Called when the 3D context state is unknown. */ |
41 void resetContext(); | 41 void resetContext(); |
42 | 42 |
43 /** | 43 /** |
44 * Called when the GPU resources have been lost and need to be abandoned | 44 * Called when the GPU resources have been lost and need to be abandoned |
45 * (for example after a context loss). | 45 * (for example after a context loss). |
46 */ | 46 */ |
47 void abandonGpuResources(); | 47 void abandonGpuResources(); |
48 | 48 |
| 49 bool shouldBindFragmentInputs() const { |
| 50 return fCaps.bindFragmentInputSupport; |
| 51 } |
| 52 |
49 // Functions for "separable shader" texturing support. | 53 // Functions for "separable shader" texturing support. |
50 void setProgramPathFragmentInputTransform(GrGLuint program, GrGLint location
, | 54 void setProgramPathFragmentInputTransform(GrGLuint program, GrGLint location
, |
51 GrGLenum genMode, GrGLint componen
ts, | 55 GrGLenum genMode, GrGLint componen
ts, |
52 const SkMatrix&); | 56 const SkMatrix&); |
53 | 57 |
54 /* Sets the projection matrix for path rendering */ | 58 /* Sets the projection matrix for path rendering */ |
55 void setProjectionMatrix(const SkMatrix& matrix, | 59 void setProjectionMatrix(const SkMatrix& matrix, |
56 const SkISize& renderTargetSize, | 60 const SkISize& renderTargetSize, |
57 GrSurfaceOrigin renderTargetOrigin); | 61 GrSurfaceOrigin renderTargetOrigin); |
58 | 62 |
59 GrGLuint genPaths(GrGLsizei range); | 63 GrGLuint genPaths(GrGLsizei range); |
60 GrGLvoid deletePaths(GrGLuint path, GrGLsizei range); | 64 GrGLvoid deletePaths(GrGLuint path, GrGLsizei range); |
61 | 65 |
62 protected: | 66 protected: |
63 void onStencilPath(const StencilPathArgs&, const GrPath*) override; | 67 void onStencilPath(const StencilPathArgs&, const GrPath*) override; |
64 void onDrawPath(const DrawPathArgs&, const GrPath*) override; | 68 void onDrawPath(const DrawPathArgs&, const GrPath*) override; |
65 void onDrawPaths(const DrawPathArgs&, const GrPathRange*, const void* indice
s, PathIndexType, | 69 void onDrawPaths(const DrawPathArgs&, const GrPathRange*, const void* indice
s, PathIndexType, |
66 const float transformValues[], PathTransformType, int count
) override; | 70 const float transformValues[], PathTransformType, int count
) override; |
67 private: | 71 private: |
| 72 /** |
| 73 * Mark certain functionality as not supported. |
| 74 */ |
| 75 struct Caps { |
| 76 bool bindFragmentInputSupport : 1; |
| 77 }; |
| 78 |
68 void flushPathStencilSettings(const GrStencilSettings&); | 79 void flushPathStencilSettings(const GrStencilSettings&); |
69 | 80 |
70 struct MatrixState { | 81 struct MatrixState { |
71 SkMatrix fViewMatrix; | 82 SkMatrix fViewMatrix; |
72 SkISize fRenderTargetSize; | 83 SkISize fRenderTargetSize; |
73 GrSurfaceOrigin fRenderTargetOrigin; | 84 GrSurfaceOrigin fRenderTargetOrigin; |
74 | 85 |
75 MatrixState() { this->invalidate(); } | 86 MatrixState() { this->invalidate(); } |
76 void invalidate() { | 87 void invalidate() { |
77 fViewMatrix = SkMatrix::InvalidMatrix(); | 88 fViewMatrix = SkMatrix::InvalidMatrix(); |
(...skipping 18 matching lines...) Expand all Loading... |
96 } | 107 } |
97 combined.preConcat(fViewMatrix); | 108 combined.preConcat(fViewMatrix); |
98 GrGLGetMatrix<Size>(destMatrix, combined); | 109 GrGLGetMatrix<Size>(destMatrix, combined); |
99 } | 110 } |
100 }; | 111 }; |
101 GrGLGpu* gpu(); | 112 GrGLGpu* gpu(); |
102 | 113 |
103 SkAutoTDelete<GrGLNameAllocator> fPathNameAllocator; | 114 SkAutoTDelete<GrGLNameAllocator> fPathNameAllocator; |
104 MatrixState fHWProjectionMatrixState; | 115 MatrixState fHWProjectionMatrixState; |
105 GrStencilSettings fHWPathStencilSettings; | 116 GrStencilSettings fHWPathStencilSettings; |
| 117 Caps fCaps; |
106 }; | 118 }; |
107 | 119 |
108 #endif | 120 #endif |
OLD | NEW |