| 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 |
| 11 #include "GrBatch.h" | 11 #include "GrBatch.h" |
| 12 #include "GrBatchFlushState.h" | 12 #include "GrBatchFlushState.h" |
| 13 #include "GrGpu.h" | 13 #include "GrGpu.h" |
| 14 #include "GrGpuCommandBuffer.h" |
| 14 #include "GrRenderTarget.h" | 15 #include "GrRenderTarget.h" |
| 15 | 16 |
| 16 class GrClearBatch final : public GrBatch { | 17 class GrClearBatch final : public GrBatch { |
| 17 public: | 18 public: |
| 18 DEFINE_BATCH_CLASS_ID | 19 DEFINE_BATCH_CLASS_ID |
| 19 | 20 |
| 20 GrClearBatch(const SkIRect& rect, GrColor color, GrRenderTarget* rt) | 21 GrClearBatch(const SkIRect& rect, GrColor color, GrRenderTarget* rt) |
| 21 : INHERITED(ClassID()) | 22 : INHERITED(ClassID()) |
| 22 , fRect(rect) | 23 , fRect(rect) |
| 23 , fColor(color) | 24 , fColor(color) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 51 fColor = cb->fColor; | 52 fColor = cb->fColor; |
| 52 return true; | 53 return true; |
| 53 } else if (cb->fColor == fColor && fRect.contains(cb->fRect)) { | 54 } else if (cb->fColor == fColor && fRect.contains(cb->fRect)) { |
| 54 return true; | 55 return true; |
| 55 } | 56 } |
| 56 return false; | 57 return false; |
| 57 } | 58 } |
| 58 | 59 |
| 59 void onPrepare(GrBatchFlushState*) override {} | 60 void onPrepare(GrBatchFlushState*) override {} |
| 60 | 61 |
| 61 void onDraw(GrBatchFlushState* state) override { | 62 void onDraw(GrBatchFlushState* state, GrGpuCommandBuffer* buffer) override { |
| 62 state->gpu()->clear(fRect, fColor, fRenderTarget.get()); | 63 buffer->clear(fRect, fColor, fRenderTarget.get()); |
| 63 } | 64 } |
| 64 | 65 |
| 65 SkIRect fRect; | 66 SkIRect fRect; |
| 66 GrColor fColor; | 67 GrColor fColor; |
| 67 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 68 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
| 68 | 69 |
| 69 typedef GrBatch INHERITED; | 70 typedef GrBatch INHERITED; |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 class GrClearStencilClipBatch final : public GrBatch { | 73 class GrClearStencilClipBatch final : public GrBatch { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 92 fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom, fIns
ideClip, | 93 fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom, fIns
ideClip, |
| 93 fRenderTarget.get()); | 94 fRenderTarget.get()); |
| 94 return string; | 95 return string; |
| 95 } | 96 } |
| 96 | 97 |
| 97 private: | 98 private: |
| 98 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } | 99 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } |
| 99 | 100 |
| 100 void onPrepare(GrBatchFlushState*) override {} | 101 void onPrepare(GrBatchFlushState*) override {} |
| 101 | 102 |
| 102 void onDraw(GrBatchFlushState* state) override { | 103 void onDraw(GrBatchFlushState* state, GrGpuCommandBuffer* buffer) override { |
| 103 state->gpu()->clearStencilClip(fRect, fInsideClip, fRenderTarget.get()); | 104 buffer->clearStencilClip(fRect, fInsideClip, fRenderTarget.get()); |
| 104 } | 105 } |
| 105 | 106 |
| 106 SkIRect fRect; | 107 SkIRect fRect; |
| 107 bool fInsideClip; | 108 bool fInsideClip; |
| 108 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 109 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
| 109 | 110 |
| 110 typedef GrBatch INHERITED; | 111 typedef GrBatch INHERITED; |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 #endif | 114 #endif |
| OLD | NEW |