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 GrInOrderDrawBuffer_DEFINED | 8 #ifndef GrInOrderDrawBuffer_DEFINED |
9 #define GrInOrderDrawBuffer_DEFINED | 9 #define GrInOrderDrawBuffer_DEFINED |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 void discard(GrRenderTarget*) SK_OVERRIDE; | 54 void discard(GrRenderTarget*) SK_OVERRIDE; |
55 | 55 |
56 protected: | 56 protected: |
57 void willReserveVertexAndIndexSpace(int vertexCount, | 57 void willReserveVertexAndIndexSpace(int vertexCount, |
58 size_t vertexStride, | 58 size_t vertexStride, |
59 int indexCount); | 59 int indexCount); |
60 | 60 |
61 private: | 61 private: |
62 typedef GrGpu::DrawArgs DrawArgs; | 62 typedef GrGpu::DrawArgs DrawArgs; |
63 enum { | |
64 kDraw_Cmd = 1, | |
65 kStencilPath_Cmd = 2, | |
66 kSetState_Cmd = 3, | |
67 kClear_Cmd = 4, | |
68 kCopySurface_Cmd = 5, | |
69 kDrawPath_Cmd = 6, | |
70 kDrawPaths_Cmd = 7, | |
71 kDrawBatch_Cmd = 8, | |
72 }; | |
73 | 63 |
74 struct SetState; | 64 struct SetState; |
75 | 65 |
76 struct Cmd : ::SkNoncopyable { | 66 struct Cmd : ::SkNoncopyable { |
| 67 enum { |
| 68 kDraw_Cmd = 1, |
| 69 kStencilPath_Cmd = 2, |
| 70 kSetState_Cmd = 3, |
| 71 kClear_Cmd = 4, |
| 72 kCopySurface_Cmd = 5, |
| 73 kDrawPath_Cmd = 6, |
| 74 kDrawPaths_Cmd = 7, |
| 75 kDrawBatch_Cmd = 8, |
| 76 }; |
| 77 |
77 Cmd(uint8_t type) : fType(type) {} | 78 Cmd(uint8_t type) : fType(type) {} |
78 virtual ~Cmd() {} | 79 virtual ~Cmd() {} |
79 | 80 |
80 virtual void execute(GrInOrderDrawBuffer*, const SetState*) = 0; | 81 virtual void execute(GrInOrderDrawBuffer*, const SetState*) = 0; |
81 | 82 |
| 83 uint8_t type() const { return fType & kCmdMask; } |
| 84 |
| 85 bool isTraced() const { return SkToBool(fType & kTraceCmdBit); } |
| 86 void makeTraced() { fType |= kTraceCmdBit; } |
| 87 |
| 88 private: |
| 89 static const int kCmdMask = 0x7F; |
| 90 static const int kTraceCmdBit = 0x80; |
| 91 |
82 uint8_t fType; | 92 uint8_t fType; |
83 }; | 93 }; |
84 | 94 |
85 struct Draw : public Cmd { | 95 struct Draw : public Cmd { |
86 Draw(const DrawInfo& info) : Cmd(kDraw_Cmd), fInfo(info) {} | 96 Draw(const DrawInfo& info) : Cmd(kDraw_Cmd), fInfo(info) {} |
87 | 97 |
88 void execute(GrInOrderDrawBuffer*, const SetState*) SK_OVERRIDE; | 98 void execute(GrInOrderDrawBuffer*, const SetState*) SK_OVERRIDE; |
89 | 99 |
90 DrawInfo fInfo; | 100 DrawInfo fInfo; |
91 }; | 101 }; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 fDrawBatch->execute(this, fPrevState); | 323 fDrawBatch->execute(this, fPrevState); |
314 fDrawBatch->fBatch->setNumberOfDraws(fBatchTarget.numberOfDraws()); | 324 fDrawBatch->fBatch->setNumberOfDraws(fBatchTarget.numberOfDraws()); |
315 fDrawBatch = NULL; | 325 fDrawBatch = NULL; |
316 } | 326 } |
317 } | 327 } |
318 | 328 |
319 typedef GrFlushToGpuDrawTarget INHERITED; | 329 typedef GrFlushToGpuDrawTarget INHERITED; |
320 }; | 330 }; |
321 | 331 |
322 #endif | 332 #endif |
OLD | NEW |