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 12 matching lines...) Expand all Loading... |
23 #include "SkMatrix.h" | 23 #include "SkMatrix.h" |
24 #include "SkPath.h" | 24 #include "SkPath.h" |
25 #include "SkStrokeRec.h" | 25 #include "SkStrokeRec.h" |
26 #include "SkTArray.h" | 26 #include "SkTArray.h" |
27 #include "SkTLazy.h" | 27 #include "SkTLazy.h" |
28 #include "SkTypes.h" | 28 #include "SkTypes.h" |
29 #include "SkXfermode.h" | 29 #include "SkXfermode.h" |
30 | 30 |
31 class GrClip; | 31 class GrClip; |
32 class GrDrawTargetCaps; | 32 class GrDrawTargetCaps; |
33 class GrIndexBufferAllocPool; | |
34 class GrPath; | 33 class GrPath; |
35 class GrPathRange; | 34 class GrPathRange; |
36 class GrPipeline; | 35 class GrPipeline; |
37 class GrVertexBufferAllocPool; | |
38 | 36 |
39 class GrDrawTarget : public SkRefCnt { | 37 class GrDrawTarget : public SkRefCnt { |
40 public: | 38 public: |
41 SK_DECLARE_INST_COUNT(GrDrawTarget) | 39 SK_DECLARE_INST_COUNT(GrDrawTarget) |
42 | 40 |
43 typedef GrPathRange::PathIndexType PathIndexType; | 41 typedef GrPathRange::PathIndexType PathIndexType; |
44 typedef GrPathRendering::PathTransformType PathTransformType; | 42 typedef GrPathRendering::PathTransformType PathTransformType; |
45 | 43 |
46 /////////////////////////////////////////////////////////////////////////// | 44 /////////////////////////////////////////////////////////////////////////// |
47 | 45 |
48 // The context may not be fully constructed and should not be used during Gr
DrawTarget | 46 // The context may not be fully constructed and should not be used during Gr
DrawTarget |
49 // construction. | 47 // construction. |
50 GrDrawTarget(GrContext* context, GrVertexBufferAllocPool*, GrIndexBufferAllo
cPool*); | 48 GrDrawTarget(GrContext* context); |
51 | 49 |
52 virtual ~GrDrawTarget() {} | 50 virtual ~GrDrawTarget() {} |
53 | 51 |
54 /** | 52 /** |
55 * Empties the draw buffer of any queued up draws. | 53 * Empties the draw buffer of any queued up draws. |
56 */ | 54 */ |
57 void reset(); | 55 void reset() { this->onReset(); } |
58 | 56 |
59 /** | 57 /** |
60 * This plays any queued up draws to its GrGpu target. It also resets this o
bject (i.e. flushing | 58 * This plays any queued up draws to its GrGpu target. It also resets this o
bject (i.e. flushing |
61 * is destructive). | 59 * is destructive). |
62 */ | 60 */ |
63 void flush(); | 61 void flush(); |
64 | 62 |
65 /** | 63 /** |
66 * Gets the capabilities of the draw target. | 64 * Gets the capabilities of the draw target. |
67 */ | 65 */ |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 231 |
234 GrGpu* getGpu() { | 232 GrGpu* getGpu() { |
235 SkASSERT(fContext && fContext->getGpu()); | 233 SkASSERT(fContext && fContext->getGpu()); |
236 return fContext->getGpu(); | 234 return fContext->getGpu(); |
237 } | 235 } |
238 const GrGpu* getGpu() const { | 236 const GrGpu* getGpu() const { |
239 SkASSERT(fContext && fContext->getGpu()); | 237 SkASSERT(fContext && fContext->getGpu()); |
240 return fContext->getGpu(); | 238 return fContext->getGpu(); |
241 } | 239 } |
242 | 240 |
243 GrVertexBufferAllocPool* getVertexAllocPool() { return fVertexPool; } | |
244 GrIndexBufferAllocPool* getIndexAllocPool() { return fIndexPool; } | |
245 | |
246 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers
; } | 241 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers
; } |
247 | 242 |
248 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required | 243 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required |
249 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it | 244 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it |
250 // needs to be accessed by GLPrograms to setup a correct drawstate | 245 // needs to be accessed by GLPrograms to setup a correct drawstate |
251 bool setupDstReadIfNecessary(const GrPipelineBuilder&, | 246 bool setupDstReadIfNecessary(const GrPipelineBuilder&, |
252 const GrProcOptInfo& colorPOI, | 247 const GrProcOptInfo& colorPOI, |
253 const GrProcOptInfo& coveragePOI, | 248 const GrProcOptInfo& coveragePOI, |
254 GrDeviceCoordTexture* dstCopy, | 249 GrDeviceCoordTexture* dstCopy, |
255 const SkRect* drawBounds); | 250 const SkRect* drawBounds); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 GrScissorState*, | 322 GrScissorState*, |
328 const SkRect* devBounds) = 0; | 323 const SkRect* devBounds) = 0; |
329 | 324 |
330 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar
get. | 325 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar
get. |
331 GrContext* fContext; | 326 GrContext* fContext; |
332 SkAutoTUnref<const GrDrawTargetCaps> fCaps; | 327 SkAutoTUnref<const GrDrawTargetCaps> fCaps; |
333 // To keep track that we always have at least as many debug marker adds as r
emoves | 328 // To keep track that we always have at least as many debug marker adds as r
emoves |
334 int fGpuTraceMar
kerCount; | 329 int fGpuTraceMar
kerCount; |
335 GrTraceMarkerSet fActiveTrace
Markers; | 330 GrTraceMarkerSet fActiveTrace
Markers; |
336 GrTraceMarkerSet fStoredTrace
Markers; | 331 GrTraceMarkerSet fStoredTrace
Markers; |
337 GrVertexBufferAllocPool* fVertexPool; | |
338 GrIndexBufferAllocPool* fIndexPool; | |
339 bool fFlushing; | 332 bool fFlushing; |
340 | 333 |
341 typedef SkRefCnt INHERITED; | 334 typedef SkRefCnt INHERITED; |
342 }; | 335 }; |
343 | 336 |
344 /* | 337 /* |
345 * This class is JUST for clip mask manager. Everyone else should just use draw
target above. | 338 * This class is JUST for clip mask manager. Everyone else should just use draw
target above. |
346 */ | 339 */ |
347 class GrClipTarget : public GrDrawTarget { | 340 class GrClipTarget : public GrDrawTarget { |
348 public: | 341 public: |
349 GrClipTarget(GrContext* context, | 342 GrClipTarget(GrContext* context) |
350 GrVertexBufferAllocPool* vpool, | 343 : INHERITED(context) { |
351 GrIndexBufferAllocPool* ipool) | |
352 : INHERITED(context, vpool, ipool) { | |
353 fClipMaskManager.setClipTarget(this); | 344 fClipMaskManager.setClipTarget(this); |
354 } | 345 } |
355 | 346 |
356 /* Clip mask manager needs access to the context. | 347 /* Clip mask manager needs access to the context. |
357 * TODO we only need a very small subset of context in the CMM. | 348 * TODO we only need a very small subset of context in the CMM. |
358 */ | 349 */ |
359 GrContext* getContext() { return INHERITED::getContext(); } | 350 GrContext* getContext() { return INHERITED::getContext(); } |
360 const GrContext* getContext() const { return INHERITED::getContext(); } | 351 const GrContext* getContext() const { return INHERITED::getContext(); } |
361 | 352 |
362 /** | 353 /** |
(...skipping 23 matching lines...) Expand all Loading... |
386 virtual bool setupClip(GrPipelineBuilder*, | 377 virtual bool setupClip(GrPipelineBuilder*, |
387 GrPipelineBuilder::AutoRestoreFragmentProcessors*, | 378 GrPipelineBuilder::AutoRestoreFragmentProcessors*, |
388 GrPipelineBuilder::AutoRestoreStencil*, | 379 GrPipelineBuilder::AutoRestoreStencil*, |
389 GrScissorState* scissorState, | 380 GrScissorState* scissorState, |
390 const SkRect* devBounds) override; | 381 const SkRect* devBounds) override; |
391 | 382 |
392 typedef GrDrawTarget INHERITED; | 383 typedef GrDrawTarget INHERITED; |
393 }; | 384 }; |
394 | 385 |
395 #endif | 386 #endif |
OLD | NEW |