| 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 "GrRenderTarget.h" | 14 #include "GrRenderTarget.h" |
| 15 | 15 |
| 16 class GrClearBatch final : public GrBatch { | 16 class GrClearBatch final : public GrBatch { |
| 17 public: | 17 public: |
| 18 GrClearBatch(const SkIRect& rect, GrColor color, GrRenderTarget* rt) | 18 GrClearBatch(const SkIRect& rect, GrColor color, GrRenderTarget* rt) |
| 19 : fRect(rect) | 19 : fRect(rect) |
| 20 , fColor(color) | 20 , fColor(color) |
| 21 , fRenderTarget(rt) { | 21 , fRenderTarget(rt) { |
| 22 this->initClassID<GrClearBatch>(); | 22 this->initClassID<GrClearBatch>(); |
| 23 fBounds = SkRect::Make(rect); | 23 fBounds = SkRect::Make(rect); |
| 24 } | 24 } |
| 25 | 25 |
| 26 BATCH_CLASS_ID |
| 27 |
| 26 const char* name() const override { return "Clear"; } | 28 const char* name() const override { return "Clear"; } |
| 27 | 29 |
| 28 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } | 30 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } |
| 29 | 31 |
| 30 SkString dumpInfo() const override { | 32 SkString dumpInfo() const override { |
| 31 SkString string; | 33 SkString string; |
| 32 string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: 0x%
p", | 34 string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: 0x%
p", |
| 33 fColor, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBott
om, | 35 fColor, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBott
om, |
| 34 fRenderTarget.get()); | 36 fRenderTarget.get()); |
| 35 return string; | 37 return string; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 55 class GrClearStencilClipBatch final : public GrBatch { | 57 class GrClearStencilClipBatch final : public GrBatch { |
| 56 public: | 58 public: |
| 57 GrClearStencilClipBatch(const SkIRect& rect, bool insideClip, GrRenderTarget
* rt) | 59 GrClearStencilClipBatch(const SkIRect& rect, bool insideClip, GrRenderTarget
* rt) |
| 58 : fRect(rect) | 60 : fRect(rect) |
| 59 , fInsideClip(insideClip) | 61 , fInsideClip(insideClip) |
| 60 , fRenderTarget(rt) { | 62 , fRenderTarget(rt) { |
| 61 this->initClassID<GrClearStencilClipBatch>(); | 63 this->initClassID<GrClearStencilClipBatch>(); |
| 62 fBounds = SkRect::Make(rect); | 64 fBounds = SkRect::Make(rect); |
| 63 } | 65 } |
| 64 | 66 |
| 67 BATCH_CLASS_ID |
| 68 |
| 65 const char* name() const override { return "ClearStencilClip"; } | 69 const char* name() const override { return "ClearStencilClip"; } |
| 66 | 70 |
| 67 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } | 71 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } |
| 68 | 72 |
| 69 SkString dumpInfo() const override { | 73 SkString dumpInfo() const override { |
| 70 SkString string; | 74 SkString string; |
| 71 string.printf("Rect [L: %d, T: %d, R: %d, B: %d], IC: %d, RT: 0x%p", | 75 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, | 76 fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom, fIns
ideClip, |
| 73 fRenderTarget.get()); | 77 fRenderTarget.get()); |
| 74 return string; | 78 return string; |
| 75 } | 79 } |
| 76 | 80 |
| 77 private: | 81 private: |
| 78 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } | 82 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } |
| 79 | 83 |
| 80 void onPrepare(GrBatchFlushState*) override {} | 84 void onPrepare(GrBatchFlushState*) override {} |
| 81 | 85 |
| 82 void onDraw(GrBatchFlushState* state) override { | 86 void onDraw(GrBatchFlushState* state) override { |
| 83 state->gpu()->clearStencilClip(fRect, fInsideClip, fRenderTarget.get()); | 87 state->gpu()->clearStencilClip(fRect, fInsideClip, fRenderTarget.get()); |
| 84 } | 88 } |
| 85 | 89 |
| 86 SkIRect fRect; | 90 SkIRect fRect; |
| 87 bool fInsideClip; | 91 bool fInsideClip; |
| 88 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 92 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
| 89 }; | 93 }; |
| 90 | 94 |
| 91 #endif | 95 #endif |
| OLD | NEW |