| 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 GrDiscardBatch_DEFINED | 8 #ifndef GrDiscardBatch_DEFINED |
| 9 #define GrDiscardBatch_DEFINED | 9 #define GrDiscardBatch_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 GrDiscardBatch final : public GrBatch { | 16 class GrDiscardBatch final : public GrBatch { |
| 17 public: | 17 public: |
| 18 DEFINE_BATCH_CLASS_ID | 18 DEFINE_BATCH_CLASS_ID |
| 19 | 19 |
| 20 GrDiscardBatch(GrRenderTarget* rt) | 20 GrDiscardBatch(GrRenderTarget* rt) |
| 21 : INHERITED(ClassID()) | 21 : INHERITED(ClassID()) |
| 22 , fRenderTarget(rt) { | 22 , fRenderTarget(rt) { |
| 23 fBounds = SkRect::MakeWH(SkIntToScalar(rt->width()), SkIntToScalar(rt->h
eight())); | 23 this->setBounds(SkRect::MakeIWH(rt->width(), rt->height()), HasAABloat::
kNo, |
| 24 IsZeroArea::kNo); |
| 24 } | 25 } |
| 25 | 26 |
| 26 const char* name() const override { return "Discard"; } | 27 const char* name() const override { return "Discard"; } |
| 27 | 28 |
| 28 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } | 29 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()-
>getUniqueID(); } |
| 29 GrRenderTarget* renderTarget() const override { return fRenderTarget.get();
} | 30 GrRenderTarget* renderTarget() const override { return fRenderTarget.get();
} |
| 30 | 31 |
| 31 SkString dumpInfo() const override { | 32 SkString dumpInfo() const override { |
| 32 SkString string; | 33 SkString string; |
| 33 string.printf("RT: %d", fRenderTarget.get()->getUniqueID()); | 34 string.printf("RT: %d", fRenderTarget.get()->getUniqueID()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 45 void onDraw(GrBatchFlushState* state) override { | 46 void onDraw(GrBatchFlushState* state) override { |
| 46 state->commandBuffer()->discard(fRenderTarget.get()); | 47 state->commandBuffer()->discard(fRenderTarget.get()); |
| 47 } | 48 } |
| 48 | 49 |
| 49 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 50 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
| 50 | 51 |
| 51 typedef GrBatch INHERITED; | 52 typedef GrBatch INHERITED; |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 #endif | 55 #endif |
| OLD | NEW |