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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 const char* name() const override { return "Clear"; } | 29 const char* name() const override { return "Clear"; } |
30 | 30 |
31 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } | 31 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } |
32 GrRenderTarget* renderTarget() const override { return fRenderTarget.get();
} | 32 GrRenderTarget* renderTarget() const override { return fRenderTarget.get();
} |
33 | 33 |
34 SkString dumpInfo() const override { | 34 SkString dumpInfo() const override { |
35 SkString string; | 35 SkString string; |
36 string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: %d"
, | 36 string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: %d"
, |
37 fColor, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBott
om, | 37 fColor, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBott
om, |
38 fRenderTarget.get()->getUniqueID()); | 38 fRenderTarget.get()->getUniqueID()); |
| 39 string.append(INHERITED::dumpInfo()); |
39 return string; | 40 return string; |
40 } | 41 } |
41 | 42 |
42 private: | 43 private: |
43 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { | 44 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
44 // This could be much more complicated. Currently we look at cases where
the new clear | 45 // This could be much more complicated. Currently we look at cases where
the new clear |
45 // contains the old clear, or when the new clear is a subset of the old
clear and is the | 46 // contains the old clear, or when the new clear is a subset of the old
clear and is the |
46 // same color. | 47 // same color. |
47 GrClearBatch* cb = t->cast<GrClearBatch>(); | 48 GrClearBatch* cb = t->cast<GrClearBatch>(); |
48 SkASSERT(cb->fRenderTarget == fRenderTarget); | 49 SkASSERT(cb->fRenderTarget == fRenderTarget); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 const char* name() const override { return "ClearStencilClip"; } | 86 const char* name() const override { return "ClearStencilClip"; } |
86 | 87 |
87 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } | 88 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } |
88 GrRenderTarget* renderTarget() const override { return fRenderTarget.get();
} | 89 GrRenderTarget* renderTarget() const override { return fRenderTarget.get();
} |
89 | 90 |
90 SkString dumpInfo() const override { | 91 SkString dumpInfo() const override { |
91 SkString string; | 92 SkString string; |
92 string.printf("Rect [L: %d, T: %d, R: %d, B: %d], IC: %d, RT: 0x%p", | 93 string.printf("Rect [L: %d, T: %d, R: %d, B: %d], IC: %d, RT: 0x%p", |
93 fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom, fIns
ideClip, | 94 fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom, fIns
ideClip, |
94 fRenderTarget.get()); | 95 fRenderTarget.get()); |
| 96 string.append(INHERITED::dumpInfo()); |
95 return string; | 97 return string; |
96 } | 98 } |
97 | 99 |
98 private: | 100 private: |
99 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } | 101 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } |
100 | 102 |
101 void onPrepare(GrBatchFlushState*) override {} | 103 void onPrepare(GrBatchFlushState*) override {} |
102 | 104 |
103 void onDraw(GrBatchFlushState* state) override { | 105 void onDraw(GrBatchFlushState* state) override { |
104 state->commandBuffer()->clearStencilClip(fRect, fInsideClip, fRenderTarg
et.get()); | 106 state->commandBuffer()->clearStencilClip(fRect, fInsideClip, fRenderTarg
et.get()); |
105 } | 107 } |
106 | 108 |
107 SkIRect fRect; | 109 SkIRect fRect; |
108 bool fInsideClip; | 110 bool fInsideClip; |
109 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 111 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
110 | 112 |
111 typedef GrBatch INHERITED; | 113 typedef GrBatch INHERITED; |
112 }; | 114 }; |
113 | 115 |
114 #endif | 116 #endif |
OLD | NEW |