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 GrClearBatch_DEFINED | 8 #ifndef GrClearBatch_DEFINED |
9 #define GrClearBatch_DEFINED | 9 #define GrClearBatch_DEFINED |
10 | 10 |
11 #include "GrBatch.h" | 11 #include "GrBatch.h" |
12 #include "GrBatchFlushState.h" | 12 #include "GrBatchFlushState.h" |
13 #include "GrGpu.h" | 13 #include "GrGpu.h" |
14 #include "GrRenderTarget.h" | 14 #include "GrRenderTarget.h" |
15 | 15 |
16 class GrClearBatch final : public GrBatch { | 16 class GrClearBatch final : public GrBatch { |
17 public: | 17 public: |
| 18 DEFINE_BATCH_CLASS_ID |
| 19 |
18 GrClearBatch(const SkIRect& rect, GrColor color, GrRenderTarget* rt) | 20 GrClearBatch(const SkIRect& rect, GrColor color, GrRenderTarget* rt) |
19 : fRect(rect) | 21 : INHERITED(ClassID()) |
| 22 , fRect(rect) |
20 , fColor(color) | 23 , fColor(color) |
21 , fRenderTarget(rt) { | 24 , fRenderTarget(rt) { |
22 this->initClassID<GrClearBatch>(); | |
23 fBounds = SkRect::Make(rect); | 25 fBounds = SkRect::Make(rect); |
24 } | 26 } |
25 | 27 |
26 const char* name() const override { return "Clear"; } | 28 const char* name() const override { return "Clear"; } |
27 | 29 |
28 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } | 30 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } |
29 | 31 |
30 SkString dumpInfo() const override { | 32 SkString dumpInfo() const override { |
31 SkString string; | 33 SkString string; |
32 string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: 0x%
p", | 34 string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: 0x%
p", |
(...skipping 10 matching lines...) Expand all Loading... |
43 | 45 |
44 void onPrepare(GrBatchFlushState*) override {} | 46 void onPrepare(GrBatchFlushState*) override {} |
45 | 47 |
46 void onDraw(GrBatchFlushState* state) override { | 48 void onDraw(GrBatchFlushState* state) override { |
47 state->gpu()->clear(fRect, fColor, fRenderTarget.get()); | 49 state->gpu()->clear(fRect, fColor, fRenderTarget.get()); |
48 } | 50 } |
49 | 51 |
50 SkIRect fRect; | 52 SkIRect fRect; |
51 GrColor fColor; | 53 GrColor fColor; |
52 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 54 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
| 55 |
| 56 typedef GrBatch INHERITED; |
53 }; | 57 }; |
54 | 58 |
55 class GrClearStencilClipBatch final : public GrBatch { | 59 class GrClearStencilClipBatch final : public GrBatch { |
56 public: | 60 public: |
| 61 DEFINE_BATCH_CLASS_ID |
| 62 |
57 GrClearStencilClipBatch(const SkIRect& rect, bool insideClip, GrRenderTarget
* rt) | 63 GrClearStencilClipBatch(const SkIRect& rect, bool insideClip, GrRenderTarget
* rt) |
58 : fRect(rect) | 64 : INHERITED(ClassID()) |
| 65 , fRect(rect) |
59 , fInsideClip(insideClip) | 66 , fInsideClip(insideClip) |
60 , fRenderTarget(rt) { | 67 , fRenderTarget(rt) { |
61 this->initClassID<GrClearStencilClipBatch>(); | |
62 fBounds = SkRect::Make(rect); | 68 fBounds = SkRect::Make(rect); |
63 } | 69 } |
64 | 70 |
65 const char* name() const override { return "ClearStencilClip"; } | 71 const char* name() const override { return "ClearStencilClip"; } |
66 | 72 |
67 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } | 73 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } |
68 | 74 |
69 SkString dumpInfo() const override { | 75 SkString dumpInfo() const override { |
70 SkString string; | 76 SkString string; |
71 string.printf("Rect [L: %d, T: %d, R: %d, B: %d], IC: %d, RT: 0x%p", | 77 string.printf("Rect [L: %d, T: %d, R: %d, B: %d], IC: %d, RT: 0x%p", |
72 fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom, fIns
ideClip, | 78 fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom, fIns
ideClip, |
73 fRenderTarget.get()); | 79 fRenderTarget.get()); |
74 return string; | 80 return string; |
75 } | 81 } |
76 | 82 |
77 private: | 83 private: |
78 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } | 84 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } |
79 | 85 |
80 void onPrepare(GrBatchFlushState*) override {} | 86 void onPrepare(GrBatchFlushState*) override {} |
81 | 87 |
82 void onDraw(GrBatchFlushState* state) override { | 88 void onDraw(GrBatchFlushState* state) override { |
83 state->gpu()->clearStencilClip(fRect, fInsideClip, fRenderTarget.get()); | 89 state->gpu()->clearStencilClip(fRect, fInsideClip, fRenderTarget.get()); |
84 } | 90 } |
85 | 91 |
86 SkIRect fRect; | 92 SkIRect fRect; |
87 bool fInsideClip; | 93 bool fInsideClip; |
88 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 94 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
| 95 |
| 96 typedef GrBatch INHERITED; |
89 }; | 97 }; |
90 | 98 |
91 #endif | 99 #endif |
OLD | NEW |