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 "GrClipData.h" | 11 #include "GrClipData.h" |
12 #include "GrClipMaskManager.h" | 12 #include "GrClipMaskManager.h" |
13 #include "GrContext.h" | 13 #include "GrContext.h" |
14 #include "GrDrawState.h" | 14 #include "GrDrawState.h" |
15 #include "GrIndexBuffer.h" | 15 #include "GrIndexBuffer.h" |
16 #include "GrPathRendering.h" | 16 #include "GrPathRendering.h" |
17 #include "GrTraceMarker.h" | 17 #include "GrTraceMarker.h" |
| 18 #include "GrVertexBuffer.h" |
18 | 19 |
19 #include "SkClipStack.h" | 20 #include "SkClipStack.h" |
20 #include "SkMatrix.h" | 21 #include "SkMatrix.h" |
21 #include "SkPath.h" | 22 #include "SkPath.h" |
22 #include "SkStrokeRec.h" | 23 #include "SkStrokeRec.h" |
23 #include "SkTArray.h" | 24 #include "SkTArray.h" |
24 #include "SkTLazy.h" | 25 #include "SkTLazy.h" |
25 #include "SkTypes.h" | 26 #include "SkTypes.h" |
26 #include "SkXfermode.h" | 27 #include "SkXfermode.h" |
27 | 28 |
28 class GrClipData; | 29 class GrClipData; |
29 class GrDrawTargetCaps; | 30 class GrDrawTargetCaps; |
30 class GrPath; | 31 class GrPath; |
31 class GrPathRange; | 32 class GrPathRange; |
32 class GrVertexBuffer; | |
33 | 33 |
34 class GrDrawTarget : public SkRefCnt { | 34 class GrDrawTarget : public SkRefCnt { |
35 public: | 35 public: |
36 SK_DECLARE_INST_COUNT(GrDrawTarget) | 36 SK_DECLARE_INST_COUNT(GrDrawTarget) |
37 | 37 |
38 typedef GrPathRendering::PathTransformType PathTransformType ; | 38 typedef GrPathRendering::PathTransformType PathTransformType ; |
39 | 39 |
40 /////////////////////////////////////////////////////////////////////////// | 40 /////////////////////////////////////////////////////////////////////////// |
41 | 41 |
42 // The context may not be fully constructed and should not be used during Gr
DrawTarget | 42 // The context may not be fully constructed and should not be used during Gr
DrawTarget |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 void adjustInstanceCount(int instanceOffset); | 552 void adjustInstanceCount(int instanceOffset); |
553 // shifts the start vertex | 553 // shifts the start vertex |
554 void adjustStartVertex(int vertexOffset); | 554 void adjustStartVertex(int vertexOffset); |
555 // shifts the start index | 555 // shifts the start index |
556 void adjustStartIndex(int indexOffset); | 556 void adjustStartIndex(int indexOffset); |
557 | 557 |
558 void setDevBounds(const SkRect& bounds) { | 558 void setDevBounds(const SkRect& bounds) { |
559 fDevBoundsStorage = bounds; | 559 fDevBoundsStorage = bounds; |
560 fDevBounds = &fDevBoundsStorage; | 560 fDevBounds = &fDevBoundsStorage; |
561 } | 561 } |
| 562 const GrVertexBuffer* vertexBuffer() const { return fVertexBuffer.get();
} |
| 563 const GrIndexBuffer* indexBuffer() const { return fIndexBuffer.get(); } |
| 564 void setVertexBuffer(const GrVertexBuffer* vb) { |
| 565 fVertexBuffer.reset(vb); |
| 566 } |
| 567 void setIndexBuffer(const GrIndexBuffer* ib) { |
| 568 fIndexBuffer.reset(ib); |
| 569 } |
562 const SkRect* getDevBounds() const { return fDevBounds; } | 570 const SkRect* getDevBounds() const { return fDevBounds; } |
563 | 571 |
564 // NULL if no copy of the dst is needed for the draw. | 572 // NULL if no copy of the dst is needed for the draw. |
565 const GrDeviceCoordTexture* getDstCopy() const { | 573 const GrDeviceCoordTexture* getDstCopy() const { |
566 if (fDstCopy.texture()) { | 574 if (fDstCopy.texture()) { |
567 return &fDstCopy; | 575 return &fDstCopy; |
568 } else { | 576 } else { |
569 return NULL; | 577 return NULL; |
570 } | 578 } |
571 } | 579 } |
(...skipping 10 matching lines...) Expand all Loading... |
582 int fVertexCount; | 590 int fVertexCount; |
583 int fIndexCount; | 591 int fIndexCount; |
584 | 592 |
585 int fInstanceCount; | 593 int fInstanceCount; |
586 int fVerticesPerInstance; | 594 int fVerticesPerInstance; |
587 int fIndicesPerInstance; | 595 int fIndicesPerInstance; |
588 | 596 |
589 SkRect fDevBoundsStorage; | 597 SkRect fDevBoundsStorage; |
590 SkRect* fDevBounds; | 598 SkRect* fDevBounds; |
591 | 599 |
| 600 GrPendingIOResource<const GrVertexBuffer, kRead_GrIOType> fVertexBuffer; |
| 601 GrPendingIOResource<const GrIndexBuffer, kRead_GrIOType> fIndexBuffer; |
| 602 |
592 GrDeviceCoordTexture fDstCopy; | 603 GrDeviceCoordTexture fDstCopy; |
593 }; | 604 }; |
594 | 605 |
| 606 virtual void setDrawBuffers(DrawInfo*) = 0;; |
595 bool programUnitTest(int maxStages); | 607 bool programUnitTest(int maxStages); |
596 | 608 |
597 protected: | 609 protected: |
598 // Extend access to GrDrawState::convertToPEndeingExec to subclasses. | 610 // Extend access to GrDrawState::convertToPEndeingExec to subclasses. |
599 void convertDrawStateToPendingExec(GrDrawState* ds) { | 611 void convertDrawStateToPendingExec(GrDrawState* ds) { |
600 ds->convertToPendingExec(); | 612 ds->convertToPendingExec(); |
601 } | 613 } |
602 | 614 |
603 enum GeometrySrcType { | 615 enum GeometrySrcType { |
604 kNone_GeometrySrcType, //<! src has not been specified | 616 kNone_GeometrySrcType, //<! src has not been specified |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 virtual bool setupClip(const SkRect* devBounds, | 821 virtual bool setupClip(const SkRect* devBounds, |
810 GrDrawState::AutoRestoreEffects* are, | 822 GrDrawState::AutoRestoreEffects* are, |
811 GrDrawState::AutoRestoreStencil* ars, | 823 GrDrawState::AutoRestoreStencil* ars, |
812 GrDrawState*, | 824 GrDrawState*, |
813 GrClipMaskManager::ScissorState* scissorState) SK_OVE
RRIDE; | 825 GrClipMaskManager::ScissorState* scissorState) SK_OVE
RRIDE; |
814 | 826 |
815 typedef GrDrawTarget INHERITED; | 827 typedef GrDrawTarget INHERITED; |
816 }; | 828 }; |
817 | 829 |
818 #endif | 830 #endif |
OLD | NEW |