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 #ifndef GrBufferedDrawTarget_DEFINED | 8 #ifndef GrBufferedDrawTarget_DEFINED |
9 #define GrBufferedDrawTarget_DEFINED | 9 #define GrBufferedDrawTarget_DEFINED |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 void unallocState(StateForPathDraw* state) { | 72 void unallocState(StateForPathDraw* state) { |
73 state->unref(); | 73 state->unref(); |
74 fPipelineBuffer.unalloc(state); | 74 fPipelineBuffer.unalloc(state); |
75 } | 75 } |
76 | 76 |
77 void onReset() override; | 77 void onReset() override; |
78 void onFlush() override; | 78 void onFlush() override; |
79 | 79 |
80 // overrides from GrDrawTarget | 80 // overrides from GrDrawTarget |
81 void onDrawBatch(GrBatch*) override; | 81 void onDrawBatch(GrDrawBatch*) override; |
82 void onStencilPath(const GrPipelineBuilder&, | 82 void onStencilPath(const GrPipelineBuilder&, |
83 const GrPathProcessor*, | 83 const GrPathProcessor*, |
84 const GrPath*, | 84 const GrPath*, |
85 const GrScissorState&, | 85 const GrScissorState&, |
86 const GrStencilSettings&) override; | 86 const GrStencilSettings&) override; |
87 void onDrawPath(const GrPathProcessor*, | 87 void onDrawPath(const GrPathProcessor*, |
88 const GrPath*, | 88 const GrPath*, |
89 const GrStencilSettings&, | 89 const GrStencilSettings&, |
90 const PipelineInfo&) override; | 90 const PipelineInfo&) override; |
91 void onDrawPaths(const GrPathProcessor*, | 91 void onDrawPaths(const GrPathProcessor*, |
(...skipping 10 matching lines...) Expand all Loading... |
102 GrRenderTarget* renderTarget) override; | 102 GrRenderTarget* renderTarget) override; |
103 void onCopySurface(GrSurface* dst, | 103 void onCopySurface(GrSurface* dst, |
104 GrSurface* src, | 104 GrSurface* src, |
105 const SkIRect& srcRect, | 105 const SkIRect& srcRect, |
106 const SkIPoint& dstPoint) override; | 106 const SkIPoint& dstPoint) override; |
107 | 107 |
108 bool isIssued(uint32_t drawID) override { return drawID != fDrawID; } | 108 bool isIssued(uint32_t drawID) override { return drawID != fDrawID; } |
109 | 109 |
110 StateForPathDraw* SK_WARN_UNUSED_RESULT createStateForPathDraw( | 110 StateForPathDraw* SK_WARN_UNUSED_RESULT createStateForPathDraw( |
111 const GrPrimitiveProcessor*, | 111 const GrPrimitiveProcessor*, |
112 const GrDrawTarget::PipelineInfo&, | 112 const PipelineInfo&, |
113 GrPipelineOptimizations* opts); | 113 GrPipelineOptimizations* opts); |
114 | 114 |
115 // TODO: Use a single allocator for commands and records | 115 // TODO: Use a single allocator for commands and records |
116 enum { | 116 enum { |
117 kPathIdxBufferMinReserve = 2 * 64, // 64 uint16_t's | 117 kPathIdxBufferMinReserve = 2 * 64, // 64 uint16_t's |
118 kPathXformBufferMinReserve = 2 * 64, // 64 two-float transforms | 118 kPathXformBufferMinReserve = 2 * 64, // 64 two-float transforms |
119 kPipelineBufferMinReserve = 32 * sizeof(StateForPathDraw), | 119 kPipelineBufferMinReserve = 32 * sizeof(StateForPathDraw), |
120 }; | 120 }; |
121 | 121 |
122 // every 100 flushes we should reset our fPipelineBuffer to prevent us from
holding at a | 122 // every 100 flushes we should reset our fPipelineBuffer to prevent us from
holding at a |
123 // highwater mark | 123 // highwater mark |
124 static const int kPipelineBufferHighWaterMark = 100; | 124 static const int kPipelineBufferHighWaterMark = 100; |
125 | 125 |
126 SkAutoTDelete<GrCommandBuilder> fCommands; | 126 SkAutoTDelete<GrCommandBuilder> fCommands; |
127 SkChunkAlloc fPathIndexBuffer; | 127 SkChunkAlloc fPathIndexBuffer; |
128 SkChunkAlloc fPathTransformBuffer; | 128 SkChunkAlloc fPathTransformBuffer; |
129 SkChunkAlloc fPipelineBuffer; | 129 SkChunkAlloc fPipelineBuffer; |
130 uint32_t fDrawID; | 130 uint32_t fDrawID; |
131 SkAutoTUnref<StateForPathDraw> fPrevState; | 131 SkAutoTUnref<StateForPathDraw> fPrevState; |
132 | 132 |
133 typedef GrClipTarget INHERITED; | 133 typedef GrClipTarget INHERITED; |
134 }; | 134 }; |
135 | 135 |
136 #endif | 136 #endif |
OLD | NEW |