OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef GrClearStencilClipBatch_DEFINED |
| 9 #define GrClearStencilClipBatch_DEFINED |
| 10 |
| 11 #include "GrBatch.h" |
| 12 #include "GrBatchFlushState.h" |
| 13 #include "GrGpu.h" |
| 14 #include "GrGpuCommandBuffer.h" |
| 15 #include "GrRenderTarget.h" |
| 16 |
| 17 class GrClearStencilClipBatch final : public GrBatch { |
| 18 public: |
| 19 DEFINE_BATCH_CLASS_ID |
| 20 |
| 21 GrClearStencilClipBatch(const SkIRect& rect, bool insideClip, GrRenderTarget
* rt) |
| 22 : INHERITED(ClassID()) |
| 23 , fRect(rect) |
| 24 , fInsideClip(insideClip) |
| 25 , fRenderTarget(rt) { |
| 26 this->setBounds(SkRect::Make(rect), HasAABloat::kNo, IsZeroArea::kNo); |
| 27 } |
| 28 |
| 29 const char* name() const override { return "ClearStencilClip"; } |
| 30 |
| 31 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } |
| 32 GrRenderTarget* renderTarget() const override { return fRenderTarget.get();
} |
| 33 |
| 34 SkString dumpInfo() const override { |
| 35 SkString string; |
| 36 string.printf("Rect [L: %d, T: %d, R: %d, B: %d], IC: %d, RT: %d", |
| 37 fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom, fIns
ideClip, |
| 38 fRenderTarget.get()->getUniqueID()); |
| 39 string.append(INHERITED::dumpInfo()); |
| 40 return string; |
| 41 } |
| 42 |
| 43 private: |
| 44 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } |
| 45 |
| 46 void onPrepare(GrBatchFlushState*) override {} |
| 47 |
| 48 void onDraw(GrBatchFlushState* state) override { |
| 49 state->commandBuffer()->clearStencilClip(fRect, fInsideClip, fRenderTarg
et.get()); |
| 50 } |
| 51 |
| 52 SkIRect fRect; |
| 53 bool fInsideClip; |
| 54 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
| 55 |
| 56 typedef GrBatch INHERITED; |
| 57 }; |
| 58 |
| 59 #endif |
OLD | NEW |