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 "GrGpuCommandBuffer.h" |
15 #include "GrRenderTarget.h" | 15 #include "GrRenderTarget.h" |
16 | 16 |
17 class GrClearBatch final : public GrBatch { | 17 class GrClearBatch final : public GrBatch { |
18 public: | 18 public: |
19 DEFINE_BATCH_CLASS_ID | 19 DEFINE_BATCH_CLASS_ID |
20 | 20 |
21 static sk_sp<GrBatch> Make(const SkIRect& rect, GrColor color, GrRenderTarg
et* rt) { | 21 static sk_sp<GrClearBatch> Make(const SkIRect& rect, GrColor color, GrRende
rTarget* rt) { |
22 return sk_sp<GrBatch>(new GrClearBatch(rect, color, rt)); | 22 return sk_sp<GrClearBatch>(new GrClearBatch(rect, color, rt)); |
23 } | 23 } |
24 | 24 |
25 const char* name() const override { return "Clear"; } | 25 const char* name() const override { return "Clear"; } |
26 | 26 |
27 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } | 27 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } |
28 GrRenderTarget* renderTarget() const override { return fRenderTarget.get();
} | 28 GrRenderTarget* renderTarget() const override { return fRenderTarget.get();
} |
29 | 29 |
30 SkString dumpInfo() const override { | 30 SkString dumpInfo() const override { |
31 SkString string; | 31 SkString string; |
32 string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: %d"
, | 32 string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: %d"
, |
33 fColor, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBott
om, | 33 fColor, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBott
om, |
34 fRenderTarget.get()->getUniqueID()); | 34 fRenderTarget.get()->getUniqueID()); |
35 string.append(INHERITED::dumpInfo()); | 35 string.append(INHERITED::dumpInfo()); |
36 return string; | 36 return string; |
37 } | 37 } |
38 | 38 |
| 39 void setColor(GrColor color) { fColor = color; } |
| 40 |
39 private: | 41 private: |
40 GrClearBatch(const SkIRect& rect, GrColor color, GrRenderTarget* rt) | 42 GrClearBatch(const SkIRect& rect, GrColor color, GrRenderTarget* rt) |
41 : INHERITED(ClassID()) | 43 : INHERITED(ClassID()) |
42 , fRect(rect) | 44 , fRect(rect) |
43 , fColor(color) | 45 , fColor(color) |
44 , fRenderTarget(rt) { | 46 , fRenderTarget(rt) { |
45 this->setBounds(SkRect::Make(rect), HasAABloat::kNo, IsZeroArea::kNo); | 47 this->setBounds(SkRect::Make(rect), HasAABloat::kNo, IsZeroArea::kNo); |
46 } | 48 } |
47 | 49 |
48 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { | 50 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
(...skipping 20 matching lines...) Expand all Loading... |
69 } | 71 } |
70 | 72 |
71 SkIRect fRect; | 73 SkIRect fRect; |
72 GrColor fColor; | 74 GrColor fColor; |
73 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 75 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
74 | 76 |
75 typedef GrBatch INHERITED; | 77 typedef GrBatch INHERITED; |
76 }; | 78 }; |
77 | 79 |
78 #endif | 80 #endif |
OLD | NEW |