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 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 const GrSurface* src, | 195 const GrSurface* src, |
196 const SkIRect& srcRect, | 196 const SkIRect& srcRect, |
197 const SkIPoint& dstPoint); | 197 const SkIPoint& dstPoint); |
198 | 198 |
199 /** | 199 /** |
200 * Release any resources that are cached but not currently in use. This | 200 * Release any resources that are cached but not currently in use. This |
201 * is intended to give an application some recourse when resources are low. | 201 * is intended to give an application some recourse when resources are low. |
202 */ | 202 */ |
203 virtual void purgeResources() {}; | 203 virtual void purgeResources() {}; |
204 | 204 |
| 205 /////////////////////////////////////////////////////////////////////////// |
| 206 // Draw execution tracking (for font atlases and other resources) |
| 207 class DrawToken { |
| 208 public: |
| 209 DrawToken(GrDrawTarget* drawTarget, uint32_t drawID) : |
| 210 fDrawTarget(drawTarget), fDrawID(drawID) {} |
| 211 |
| 212 bool isIssued() { return fDrawTarget && fDrawTarget->isIssued(fDrawID);
} |
| 213 |
| 214 private: |
| 215 GrDrawTarget* fDrawTarget; |
| 216 uint32_t fDrawID; // this may wrap, but we're doing direct compa
rison |
| 217 // so that should be okay |
| 218 }; |
| 219 |
| 220 virtual DrawToken getCurrentDrawToken() { return DrawToken(this, 0); } |
| 221 |
205 bool programUnitTest(int maxStages); | 222 bool programUnitTest(int maxStages); |
206 | 223 |
207 protected: | 224 protected: |
208 friend class GrCommandBuilder; // for PipelineInfo | 225 friend class GrCommandBuilder; // for PipelineInfo |
209 friend class GrInOrderCommandBuilder; // for PipelineInfo | 226 friend class GrInOrderCommandBuilder; // for PipelineInfo |
210 friend class GrReorderCommandBuilder; // for PipelineInfo | 227 friend class GrReorderCommandBuilder; // for PipelineInfo |
211 friend class GrTargetCommands; // for PipelineInfo | 228 friend class GrTargetCommands; // for PipelineInfo |
212 | 229 |
213 GrContext* getContext() { return fContext; } | 230 GrContext* getContext() { return fContext; } |
214 const GrContext* getContext() const { return fContext; } | 231 const GrContext* getContext() const { return fContext; } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 virtual bool setupClip(GrPipelineBuilder*, | 378 virtual bool setupClip(GrPipelineBuilder*, |
362 GrPipelineBuilder::AutoRestoreFragmentProcessors*, | 379 GrPipelineBuilder::AutoRestoreFragmentProcessors*, |
363 GrPipelineBuilder::AutoRestoreStencil*, | 380 GrPipelineBuilder::AutoRestoreStencil*, |
364 GrScissorState* scissorState, | 381 GrScissorState* scissorState, |
365 const SkRect* devBounds) override; | 382 const SkRect* devBounds) override; |
366 | 383 |
367 typedef GrDrawTarget INHERITED; | 384 typedef GrDrawTarget INHERITED; |
368 }; | 385 }; |
369 | 386 |
370 #endif | 387 #endif |
OLD | NEW |