OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 GrDrawTarget_DEFINED | 8 #ifndef GrDrawTarget_DEFINED |
9 #define GrDrawTarget_DEFINED | 9 #define GrDrawTarget_DEFINED |
10 | 10 |
11 #include "GrClip.h" | 11 #include "GrClip.h" |
12 #include "GrClipMaskManager.h" | 12 #include "GrClipMaskManager.h" |
13 #include "GrContext.h" | 13 #include "GrContext.h" |
14 #include "GrPathProcessor.h" | 14 #include "GrPathProcessor.h" |
15 #include "GrPrimitiveProcessor.h" | 15 #include "GrPrimitiveProcessor.h" |
16 #include "GrIndexBuffer.h" | 16 #include "GrIndexBuffer.h" |
17 #include "GrPathRendering.h" | 17 #include "GrPathRendering.h" |
18 #include "GrPipelineBuilder.h" | 18 #include "GrPipelineBuilder.h" |
19 #include "GrPipeline.h" | 19 #include "GrPipeline.h" |
20 #include "GrTraceMarker.h" | |
21 #include "GrVertexBuffer.h" | 20 #include "GrVertexBuffer.h" |
22 #include "GrXferProcessor.h" | 21 #include "GrXferProcessor.h" |
23 | 22 |
24 #include "SkClipStack.h" | 23 #include "SkClipStack.h" |
25 #include "SkMatrix.h" | 24 #include "SkMatrix.h" |
26 #include "SkPath.h" | 25 #include "SkPath.h" |
27 #include "SkStrokeRec.h" | 26 #include "SkStrokeRec.h" |
28 #include "SkTArray.h" | 27 #include "SkTArray.h" |
29 #include "SkTLazy.h" | 28 #include "SkTLazy.h" |
30 #include "SkTypes.h" | 29 #include "SkTypes.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 */ | 157 */ |
159 void clear(const SkIRect* rect, | 158 void clear(const SkIRect* rect, |
160 GrColor color, | 159 GrColor color, |
161 bool canIgnoreRect, | 160 bool canIgnoreRect, |
162 GrRenderTarget* renderTarget); | 161 GrRenderTarget* renderTarget); |
163 | 162 |
164 /** Discards the contents render target. */ | 163 /** Discards the contents render target. */ |
165 void discard(GrRenderTarget*); | 164 void discard(GrRenderTarget*); |
166 | 165 |
167 /** | 166 /** |
168 * Called at start and end of gpu trace marking | |
169 * GR_CREATE_GPU_TRACE_MARKER(marker_str, target) will automatically call th
ese at the start | |
170 * and end of a code block respectively | |
171 */ | |
172 void addGpuTraceMarker(const GrGpuTraceMarker* marker); | |
173 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); | |
174 | |
175 /** | |
176 * Takes the current active set of markers and stores them for later use. An
y current marker | |
177 * in the active set is removed from the active set and the targets remove f
unction is called. | |
178 * These functions do not work as a stack so you cannot call save a second t
ime before calling | |
179 * restore. Also, it is assumed that when restore is called the current acti
ve set of markers | |
180 * is empty. When the stored markers are added back into the active set, the
targets add marker | |
181 * is called. | |
182 */ | |
183 void saveActiveTraceMarkers(); | |
184 void restoreActiveTraceMarkers(); | |
185 | |
186 /** | |
187 * Copies a pixel rectangle from one surface to another. This call may final
ize | 167 * Copies a pixel rectangle from one surface to another. This call may final
ize |
188 * reserved vertex/index data (as though a draw call was made). The src pixe
ls | 168 * reserved vertex/index data (as though a draw call was made). The src pixe
ls |
189 * copied are specified by srcRect. They are copied to a rect of the same | 169 * copied are specified by srcRect. They are copied to a rect of the same |
190 * size in dst with top left at dstPoint. If the src rect is clipped by the | 170 * size in dst with top left at dstPoint. If the src rect is clipped by the |
191 * src bounds then pixel values in the dst rect corresponding to area clipp
ed | 171 * src bounds then pixel values in the dst rect corresponding to area clipp
ed |
192 * by the src rect are not overwritten. This method is not guaranteed to suc
ceed | 172 * by the src rect are not overwritten. This method is not guaranteed to suc
ceed |
193 * depending on the type of surface, configs, etc, and the backend-specific | 173 * depending on the type of surface, configs, etc, and the backend-specific |
194 * limitations. | 174 * limitations. |
195 */ | 175 */ |
196 void copySurface(GrSurface* dst, | 176 void copySurface(GrSurface* dst, |
(...skipping 22 matching lines...) Expand all Loading... |
219 const GrPipeline::CreateArgs& pipelineCreateArgs() const { | 199 const GrPipeline::CreateArgs& pipelineCreateArgs() const { |
220 SkASSERT(this->valid()); | 200 SkASSERT(this->valid()); |
221 return fArgs; | 201 return fArgs; |
222 } | 202 } |
223 | 203 |
224 private: | 204 private: |
225 GrPipeline::CreateArgs fArgs; | 205 GrPipeline::CreateArgs fArgs; |
226 }; | 206 }; |
227 | 207 |
228 protected: | 208 protected: |
229 | |
230 GrGpu* getGpu() { return fGpu; } | 209 GrGpu* getGpu() { return fGpu; } |
231 const GrGpu* getGpu() const { return fGpu; } | 210 const GrGpu* getGpu() const { return fGpu; } |
232 | 211 |
233 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers
; } | |
234 | |
235 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required | 212 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required |
236 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it | 213 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it |
237 // needs to be accessed by GLPrograms to setup a correct drawstate | 214 // needs to be accessed by GLPrograms to setup a correct drawstate |
238 bool setupDstReadIfNecessary(const GrPipelineBuilder&, | 215 bool setupDstReadIfNecessary(const GrPipelineBuilder&, |
239 const GrProcOptInfo& colorPOI, | 216 const GrProcOptInfo& colorPOI, |
240 const GrProcOptInfo& coveragePOI, | 217 const GrProcOptInfo& coveragePOI, |
241 GrXferProcessor::DstTexture*, | 218 GrXferProcessor::DstTexture*, |
242 const SkRect* drawBounds); | 219 const SkRect* drawBounds); |
243 | 220 |
244 virtual void onDrawBatch(GrBatch*) = 0; | 221 virtual void onDrawBatch(GrBatch*) = 0; |
(...skipping 21 matching lines...) Expand all Loading... |
266 virtual GrClipMaskManager* clipMaskManager() = 0; | 243 virtual GrClipMaskManager* clipMaskManager() = 0; |
267 virtual bool setupClip(const GrPipelineBuilder&, | 244 virtual bool setupClip(const GrPipelineBuilder&, |
268 GrPipelineBuilder::AutoRestoreFragmentProcessorState*
, | 245 GrPipelineBuilder::AutoRestoreFragmentProcessorState*
, |
269 GrPipelineBuilder::AutoRestoreStencil*, | 246 GrPipelineBuilder::AutoRestoreStencil*, |
270 GrScissorState*, | 247 GrScissorState*, |
271 const SkRect* devBounds) = 0; | 248 const SkRect* devBounds) = 0; |
272 | 249 |
273 GrGpu* fGpu; | 250 GrGpu* fGpu; |
274 const GrCaps* fCaps; | 251 const GrCaps* fCaps; |
275 GrResourceProvider* fResourceProvider; | 252 GrResourceProvider* fResourceProvider; |
276 // To keep track that we always have at least as many debug marker adds as r
emoves | |
277 int fGpuTraceMarkerCount; | |
278 GrTraceMarkerSet fActiveTraceMarkers; | |
279 GrTraceMarkerSet fStoredTraceMarkers; | |
280 bool fFlushing; | 253 bool fFlushing; |
281 | 254 |
282 typedef SkRefCnt INHERITED; | 255 typedef SkRefCnt INHERITED; |
283 }; | 256 }; |
284 | 257 |
285 /* | 258 /* |
286 * This class is JUST for clip mask manager. Everyone else should just use draw
target above. | 259 * This class is JUST for clip mask manager. Everyone else should just use draw
target above. |
287 */ | 260 */ |
288 class GrClipTarget : public GrDrawTarget { | 261 class GrClipTarget : public GrDrawTarget { |
289 public: | 262 public: |
(...skipping 29 matching lines...) Expand all Loading... |
319 bool setupClip(const GrPipelineBuilder&, | 292 bool setupClip(const GrPipelineBuilder&, |
320 GrPipelineBuilder::AutoRestoreFragmentProcessorState*, | 293 GrPipelineBuilder::AutoRestoreFragmentProcessorState*, |
321 GrPipelineBuilder::AutoRestoreStencil*, | 294 GrPipelineBuilder::AutoRestoreStencil*, |
322 GrScissorState* scissorState, | 295 GrScissorState* scissorState, |
323 const SkRect* devBounds) override; | 296 const SkRect* devBounds) override; |
324 | 297 |
325 typedef GrDrawTarget INHERITED; | 298 typedef GrDrawTarget INHERITED; |
326 }; | 299 }; |
327 | 300 |
328 #endif | 301 #endif |
OLD | NEW |