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