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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 void onDraw(GrBatchFlushState* state) override { | 46 void onDraw(GrBatchFlushState* state) override { |
47 state->gpu()->clear(fRect, fColor, fRenderTarget.get()); | 47 state->gpu()->clear(fRect, fColor, fRenderTarget.get()); |
48 } | 48 } |
49 | 49 |
50 SkIRect fRect; | 50 SkIRect fRect; |
51 GrColor fColor; | 51 GrColor fColor; |
52 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 52 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
53 }; | 53 }; |
54 | 54 |
| 55 class GrClearStencilClipBatch final : public GrBatch { |
| 56 public: |
| 57 GrClearStencilClipBatch(const SkIRect& rect, bool insideClip, GrRenderTarget
* rt) |
| 58 : fRect(rect) |
| 59 , fInsideClip(insideClip) |
| 60 , fRenderTarget(rt) { |
| 61 this->initClassID<GrClearStencilClipBatch>(); |
| 62 fBounds = SkRect::Make(rect); |
| 63 } |
| 64 |
| 65 const char* name() const override { return "ClearStencilClip"; } |
| 66 |
| 67 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } |
| 68 |
| 69 SkString dumpInfo() const override { |
| 70 SkString string; |
| 71 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, |
| 73 fRenderTarget.get()); |
| 74 return string; |
| 75 } |
| 76 |
| 77 private: |
| 78 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } |
| 79 |
| 80 void onPrepare(GrBatchFlushState*) override {} |
| 81 |
| 82 void onDraw(GrBatchFlushState* state) override { |
| 83 state->gpu()->clearStencilClip(fRect, fInsideClip, fRenderTarget.get()); |
| 84 } |
| 85 |
| 86 SkIRect fRect; |
| 87 bool fInsideClip; |
| 88 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
| 89 }; |
| 90 |
55 #endif | 91 #endif |
OLD | NEW |