OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrTargetCommands_DEFINED | 8 #ifndef GrTargetCommands_DEFINED |
9 #define GrTargetCommands_DEFINED | 9 #define GrTargetCommands_DEFINED |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 // TODO: Convert all commands into GrBatch and remove this class. | 25 // TODO: Convert all commands into GrBatch and remove this class. |
26 class GrTargetCommands : ::SkNoncopyable { | 26 class GrTargetCommands : ::SkNoncopyable { |
27 public: | 27 public: |
28 GrTargetCommands() : fCmdBuffer(kCmdBufferInitialSizeInBytes), fLastFlushTok
en(0) {} | 28 GrTargetCommands() : fCmdBuffer(kCmdBufferInitialSizeInBytes), fLastFlushTok
en(0) {} |
29 | 29 |
30 class Cmd : ::SkNoncopyable { | 30 class Cmd : ::SkNoncopyable { |
31 public: | 31 public: |
32 enum CmdType { | 32 enum CmdType { |
33 kStencilPath_CmdType = 1, | 33 kStencilPath_CmdType = 1, |
34 kClearStencil_CmdType = 2, | 34 kCopySurface_CmdType = 2, |
35 kCopySurface_CmdType = 3, | 35 kDrawPath_CmdType = 3, |
36 kDrawPath_CmdType = 4, | 36 kDrawPaths_CmdType = 4, |
37 kDrawPaths_CmdType = 5, | 37 kDrawBatch_CmdType = 5, |
38 kDrawBatch_CmdType = 6, | |
39 }; | 38 }; |
40 | 39 |
41 Cmd(CmdType type) | 40 Cmd(CmdType type) |
42 : fType(type) | 41 : fType(type) |
43 #if GR_BATCH_SPEW | 42 #if GR_BATCH_SPEW |
44 , fUniqueID(GenID(&gUniqueID)) | 43 , fUniqueID(GenID(&gUniqueID)) |
45 #endif | 44 #endif |
46 {} | 45 {} |
47 virtual ~Cmd() {} | 46 virtual ~Cmd() {} |
48 | 47 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 GrDrawTarget::PathIndexType fIndexType; | 169 GrDrawTarget::PathIndexType fIndexType; |
171 float* fTransforms; | 170 float* fTransforms; |
172 GrDrawTarget::PathTransformType fTransformType; | 171 GrDrawTarget::PathTransformType fTransformType; |
173 int fCount; | 172 int fCount; |
174 GrStencilSettings fStencilSettings; | 173 GrStencilSettings fStencilSettings; |
175 | 174 |
176 private: | 175 private: |
177 GrPendingIOResource<const GrPathRange, kRead_GrIOType> fPathRange; | 176 GrPendingIOResource<const GrPathRange, kRead_GrIOType> fPathRange; |
178 }; | 177 }; |
179 | 178 |
180 // This command is ONLY used by the clip mask manager to clear the stencil c
lip bits | |
181 struct ClearStencilClip : public Cmd { | |
182 ClearStencilClip(GrRenderTarget* rt) : Cmd(kClearStencil_CmdType), fRend
erTarget(rt) {} | |
183 | |
184 GrRenderTarget* renderTarget() const { return fRenderTarget.get(); } | |
185 | |
186 void execute(GrBatchFlushState*) override; | |
187 | |
188 SkIRect fRect; | |
189 bool fInsideClip; | |
190 | |
191 private: | |
192 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | |
193 }; | |
194 | |
195 struct CopySurface : public Cmd { | 179 struct CopySurface : public Cmd { |
196 CopySurface(GrSurface* dst, GrSurface* src) | 180 CopySurface(GrSurface* dst, GrSurface* src) |
197 : Cmd(kCopySurface_CmdType) | 181 : Cmd(kCopySurface_CmdType) |
198 , fDst(dst) | 182 , fDst(dst) |
199 , fSrc(src) { | 183 , fSrc(src) { |
200 } | 184 } |
201 | 185 |
202 GrSurface* dst() const { return fDst.get(); } | 186 GrSurface* dst() const { return fDst.get(); } |
203 GrSurface* src() const { return fSrc.get(); } | 187 GrSurface* src() const { return fSrc.get(); } |
204 | 188 |
(...skipping 26 matching lines...) Expand all Loading... |
231 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. | 215 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. |
232 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; | 216 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; |
233 | 217 |
234 CmdBuffer* cmdBuffer() { return &fCmdBuffer; } | 218 CmdBuffer* cmdBuffer() { return &fCmdBuffer; } |
235 | 219 |
236 CmdBuffer fCmdBuffer; | 220 CmdBuffer fCmdBuffer; |
237 GrBatchToken fLastFlushToken; | 221 GrBatchToken fLastFlushToken; |
238 }; | 222 }; |
239 | 223 |
240 #endif | 224 #endif |
OLD | NEW |