Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: src/gpu/batches/GrClearStencilClipBatch.h

Issue 2215323003: Start using RenderTargetProxy (omnibus) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/batches/GrClearBatch.h ('k') | src/gpu/batches/GrCopySurfaceBatch.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "GrBatch.h" 11 #include "GrBatch.h"
12 #include "GrBatchFlushState.h" 12 #include "GrBatchFlushState.h"
13 #include "GrFixedClip.h" 13 #include "GrFixedClip.h"
14 #include "GrGpu.h" 14 #include "GrGpu.h"
15 #include "GrGpuCommandBuffer.h" 15 #include "GrGpuCommandBuffer.h"
16 #include "GrRenderTarget.h" 16 #include "GrRenderTarget.h"
17 17
18 class GrClearStencilClipBatch final : public GrBatch { 18 class GrClearStencilClipBatch final : public GrBatch {
19 public: 19 public:
20 DEFINE_BATCH_CLASS_ID 20 DEFINE_BATCH_CLASS_ID
21 21
22 GrClearStencilClipBatch(const GrFixedClip& clip, bool insideStencilMask, GrR enderTarget* rt) 22 GrClearStencilClipBatch(const GrFixedClip& clip, bool insideStencilMask, GrR enderTargetProxy* rtp)
23 : INHERITED(ClassID()) 23 : INHERITED(ClassID())
24 , fClip(clip) 24 , fClip(clip)
25 , fInsideStencilMask(insideStencilMask) 25 , fInsideStencilMask(insideStencilMask)
26 , fRenderTarget(rt) { 26 , fRenderTargetProxy(rtp) {
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(rtp->wid th(), rtp->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()- >uniqueID(); } 34 uint32_t renderTargetUniqueID() const override { return fRenderTargetProxy.g et()->uniqueID(); }
35 GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); } 35 GrRenderTargetProxy* rtp() const override { return fRenderTargetProxy.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()->uniqueID()); 43 string.appendf("], IC: %d, RT: %d", fInsideStencilMask, fRenderTargetPro xy.get()->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, const SkRect& /*bounds*/) override { 53 void onDraw(GrBatchFlushState* state, const SkRect& /*bounds*/) override {
54 state->commandBuffer()->clearStencilClip(fClip, fInsideStencilMask); 54 state->commandBuffer()->clearStencilClip(fClip, fInsideStencilMask);
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<GrRenderTargetProxy, kWrite_GrIOType> fRenderTargetPr oxy;
60 60
61 typedef GrBatch INHERITED; 61 typedef GrBatch INHERITED;
62 }; 62 };
63 63
64 #endif 64 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrClearBatch.h ('k') | src/gpu/batches/GrCopySurfaceBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698