OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 GrClearStencilClipBatch_DEFINED | 8 #ifndef GrClearStencilClipBatch_DEFINED |
9 #define GrClearStencilClipBatch_DEFINED | 9 #define GrClearStencilClipBatch_DEFINED |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 , fClip(clip) | 24 , fClip(clip) |
25 , fInsideStencilMask(insideStencilMask) | 25 , fInsideStencilMask(insideStencilMask) |
26 , fRenderTarget(rt) { | 26 , fRenderTarget(rt) { |
27 const SkRect& bounds = fClip.scissorEnabled() ? SkRect::Make(fClip.sciss
orRect()) | 27 const SkRect& bounds = fClip.scissorEnabled() ? SkRect::Make(fClip.sciss
orRect()) |
28 : SkRect::MakeIWH(rt->widt
h(), rt->height()); | 28 : SkRect::MakeIWH(rt->widt
h(), rt->height()); |
29 this->setBounds(bounds, HasAABloat::kNo, IsZeroArea::kNo); | 29 this->setBounds(bounds, HasAABloat::kNo, IsZeroArea::kNo); |
30 } | 30 } |
31 | 31 |
32 const char* name() const override { return "ClearStencilClip"; } | 32 const char* name() const override { return "ClearStencilClip"; } |
33 | 33 |
34 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } | 34 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>uniqueID(); } |
35 GrRenderTarget* renderTarget() const override { return fRenderTarget.get();
} | 35 GrRenderTarget* renderTarget() const override { return fRenderTarget.get();
} |
36 | 36 |
37 SkString dumpInfo() const override { | 37 SkString dumpInfo() const override { |
38 SkString string("Scissor ["); | 38 SkString string("Scissor ["); |
39 if (fClip.scissorEnabled()) { | 39 if (fClip.scissorEnabled()) { |
40 const SkIRect& r = fClip.scissorRect(); | 40 const SkIRect& r = fClip.scissorRect(); |
41 string.appendf("L: %d, T: %d, R: %d, B: %d", r.fLeft, r.fTop, r.fRig
ht, r.fBottom); | 41 string.appendf("L: %d, T: %d, R: %d, B: %d", r.fLeft, r.fTop, r.fRig
ht, r.fBottom); |
42 } | 42 } |
43 string.appendf("], IC: %d, RT: %d", fInsideStencilMask, fRenderTarget.ge
t()->getUniqueID()); | 43 string.appendf("], IC: %d, RT: %d", fInsideStencilMask, fRenderTarget.ge
t()->uniqueID()); |
44 string.append(INHERITED::dumpInfo()); | 44 string.append(INHERITED::dumpInfo()); |
45 return string; | 45 return string; |
46 } | 46 } |
47 | 47 |
48 private: | 48 private: |
49 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } | 49 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } |
50 | 50 |
51 void onPrepare(GrBatchFlushState*) override {} | 51 void onPrepare(GrBatchFlushState*) override {} |
52 | 52 |
53 void onDraw(GrBatchFlushState* state) override { | 53 void onDraw(GrBatchFlushState* state) override { |
54 state->commandBuffer()->clearStencilClip(fClip, fInsideStencilMask, fRen
derTarget.get()); | 54 state->commandBuffer()->clearStencilClip(fClip, fInsideStencilMask, fRen
derTarget.get()); |
55 } | 55 } |
56 | 56 |
57 const GrFixedClip fClip; | 57 const GrFixedClip fClip; |
58 const bool fInsideStencilMask; | 58 const bool fInsideStencilMask; |
59 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 59 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
60 | 60 |
61 typedef GrBatch INHERITED; | 61 typedef GrBatch INHERITED; |
62 }; | 62 }; |
63 | 63 |
64 #endif | 64 #endif |
OLD | NEW |