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