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