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 11 matching lines...) Expand all Loading... |
22 , fRect(rect) | 22 , fRect(rect) |
23 , fColor(color) | 23 , fColor(color) |
24 , fRenderTarget(rt) { | 24 , fRenderTarget(rt) { |
25 fBounds = SkRect::Make(rect); | 25 fBounds = SkRect::Make(rect); |
26 } | 26 } |
27 | 27 |
28 const char* name() const override { return "Clear"; } | 28 const char* name() const override { return "Clear"; } |
29 | 29 |
30 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } | 30 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } |
31 | 31 |
| 32 GrRenderTarget* rt2() const override { return fRenderTarget.get(); } |
| 33 |
32 SkString dumpInfo() const override { | 34 SkString dumpInfo() const override { |
33 SkString string; | 35 SkString string; |
34 string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: 0x%
p", | 36 string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: 0x%
p", |
35 fColor, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBott
om, | 37 fColor, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBott
om, |
36 fRenderTarget.get()); | 38 fRenderTarget.get()); |
37 return string; | 39 return string; |
38 } | 40 } |
39 | 41 |
40 private: | 42 private: |
41 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { | 43 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
(...skipping 23 matching lines...) Expand all Loading... |
65 , fRect(rect) | 67 , fRect(rect) |
66 , fInsideClip(insideClip) | 68 , fInsideClip(insideClip) |
67 , fRenderTarget(rt) { | 69 , fRenderTarget(rt) { |
68 fBounds = SkRect::Make(rect); | 70 fBounds = SkRect::Make(rect); |
69 } | 71 } |
70 | 72 |
71 const char* name() const override { return "ClearStencilClip"; } | 73 const char* name() const override { return "ClearStencilClip"; } |
72 | 74 |
73 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } | 75 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } |
74 | 76 |
| 77 GrRenderTarget* rt2() const override { return fRenderTarget.get(); } |
| 78 |
75 SkString dumpInfo() const override { | 79 SkString dumpInfo() const override { |
76 SkString string; | 80 SkString string; |
77 string.printf("Rect [L: %d, T: %d, R: %d, B: %d], IC: %d, RT: 0x%p", | 81 string.printf("Rect [L: %d, T: %d, R: %d, B: %d], IC: %d, RT: 0x%p", |
78 fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom, fIns
ideClip, | 82 fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom, fIns
ideClip, |
79 fRenderTarget.get()); | 83 fRenderTarget.get()); |
80 return string; | 84 return string; |
81 } | 85 } |
82 | 86 |
83 private: | 87 private: |
84 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } | 88 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } |
85 | 89 |
86 void onPrepare(GrBatchFlushState*) override {} | 90 void onPrepare(GrBatchFlushState*) override {} |
87 | 91 |
88 void onDraw(GrBatchFlushState* state) override { | 92 void onDraw(GrBatchFlushState* state) override { |
89 state->gpu()->clearStencilClip(fRect, fInsideClip, fRenderTarget.get()); | 93 state->gpu()->clearStencilClip(fRect, fInsideClip, fRenderTarget.get()); |
90 } | 94 } |
91 | 95 |
92 SkIRect fRect; | 96 SkIRect fRect; |
93 bool fInsideClip; | 97 bool fInsideClip; |
94 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 98 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
95 | 99 |
96 typedef GrBatch INHERITED; | 100 typedef GrBatch INHERITED; |
97 }; | 101 }; |
98 | 102 |
99 #endif | 103 #endif |
OLD | NEW |