Robert Phillips | 54190c4 | 2017-08-09 20:09:38 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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 GrDiscardOp_DEFINED |
| 9 | #define GrDiscardOp_DEFINED |
| 10 | |
| 11 | #include "GrGpuCommandBuffer.h" |
| 12 | #include "GrOp.h" |
| 13 | #include "GrOpFlushState.h" |
| 14 | #include "GrRenderTargetProxy.h" |
| 15 | |
| 16 | class GrDiscardOp final : public GrOp { |
| 17 | public: |
| 18 | DEFINE_OP_CLASS_ID |
| 19 | |
| 20 | static std::unique_ptr<GrOp> Make(GrRenderTargetProxy* proxy) { |
| 21 | return std::unique_ptr<GrOp>(new GrDiscardOp(proxy)); |
| 22 | } |
| 23 | |
| 24 | const char* name() const override { return "Discard"; } |
| 25 | |
| 26 | SkString dumpInfo() const override { |
| 27 | SkString string; |
| 28 | string.append(INHERITED::dumpInfo()); |
| 29 | return string; |
| 30 | } |
| 31 | |
| 32 | private: |
| 33 | GrDiscardOp(GrRenderTargetProxy* proxy) : INHERITED(ClassID()) { |
| 34 | this->makeFullScreen(proxy); |
| 35 | } |
| 36 | |
| 37 | bool onCombineIfPossible(GrOp* that, const GrCaps& caps) override { return false; } |
| 38 | |
| 39 | void onPrepare(GrOpFlushState*) override {} |
| 40 | |
| 41 | void onExecute(GrOpFlushState* state) override { |
| 42 | state->commandBuffer()->discard(); |
| 43 | } |
| 44 | |
| 45 | typedef GrOp INHERITED; |
| 46 | }; |
| 47 | |
| 48 | #endif |