diff options
author | 2015-02-17 09:14:33 -0800 | |
---|---|---|
committer | 2015-02-17 09:14:33 -0800 | |
commit | e5e72f1fbfa02522f30762d7d8ad07a6f9add5d9 (patch) | |
tree | 221f9b82689cd7b591d295c294055169762503c6 /src/gpu/GrInOrderDrawBuffer.h | |
parent | 50da1d8c3b3799ce22b09c83443b476b12a9af8f (diff) |
Improve GrInOrderDrawBuffer::Cmd encapsulation
In preparation for moving all the Cmds out of GrInOrderDrawBuffer.
Review URL: https://codereview.chromium.org/931673002
Diffstat (limited to 'src/gpu/GrInOrderDrawBuffer.h')
-rw-r--r-- | src/gpu/GrInOrderDrawBuffer.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h index 333150a7ab..286c545eed 100644 --- a/src/gpu/GrInOrderDrawBuffer.h +++ b/src/gpu/GrInOrderDrawBuffer.h @@ -60,25 +60,35 @@ protected: private: typedef GrGpu::DrawArgs DrawArgs; - enum { - kDraw_Cmd = 1, - kStencilPath_Cmd = 2, - kSetState_Cmd = 3, - kClear_Cmd = 4, - kCopySurface_Cmd = 5, - kDrawPath_Cmd = 6, - kDrawPaths_Cmd = 7, - kDrawBatch_Cmd = 8, - }; struct SetState; struct Cmd : ::SkNoncopyable { + enum { + kDraw_Cmd = 1, + kStencilPath_Cmd = 2, + kSetState_Cmd = 3, + kClear_Cmd = 4, + kCopySurface_Cmd = 5, + kDrawPath_Cmd = 6, + kDrawPaths_Cmd = 7, + kDrawBatch_Cmd = 8, + }; + Cmd(uint8_t type) : fType(type) {} virtual ~Cmd() {} virtual void execute(GrInOrderDrawBuffer*, const SetState*) = 0; + uint8_t type() const { return fType & kCmdMask; } + + bool isTraced() const { return SkToBool(fType & kTraceCmdBit); } + void makeTraced() { fType |= kTraceCmdBit; } + + private: + static const int kCmdMask = 0x7F; + static const int kTraceCmdBit = 0x80; + uint8_t fType; }; |