LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/gpu/ops - GrDiscardOp.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 26 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "GrGpu.h"
      12             : #include "GrOp.h"
      13             : #include "GrOpFlushState.h"
      14             : #include "GrRenderTarget.h"
      15             : 
      16           0 : class GrDiscardOp final : public GrOp {
      17             : public:
      18           0 :     DEFINE_OP_CLASS_ID
      19             : 
      20             :     // MDB TODO: replace the renderTargetContext with just the renderTargetProxy.
      21             :     // For now, we need the renderTargetContext for its accessRenderTarget powers.
      22           0 :     static std::unique_ptr<GrOp> Make(GrRenderTargetContext* rtc) {
      23             : 
      24             :         // MDB TODO: remove this. In this hybrid state we need to be sure the RT is instantiable
      25             :         // so it can carry the IO refs. In the future we will just get the proxy and
      26             :         // it carry the IO refs.
      27           0 :         if (!rtc->accessRenderTarget()) {
      28           0 :             return nullptr;
      29             :         }
      30             : 
      31           0 :         return std::unique_ptr<GrOp>(new GrDiscardOp(rtc));
      32             :     }
      33             : 
      34           0 :     const char* name() const override { return "Discard"; }
      35             : 
      36           0 :     SkString dumpInfo() const override {
      37           0 :         SkString string;
      38           0 :         string.printf("rtID: %d proxyID: %d ", fRenderTarget.get()->uniqueID().asUInt(),
      39           0 :                                                fProxyUniqueID.asUInt());
      40           0 :         string.append(INHERITED::dumpInfo());
      41           0 :         return string;
      42             :     }
      43             : 
      44             : private:
      45           0 :     GrDiscardOp(GrRenderTargetContext* rtc)
      46           0 :         : INHERITED(ClassID())
      47           0 :         , fProxyUniqueID(rtc->asSurfaceProxy()->uniqueID()) {
      48           0 :         this->setBounds(SkRect::MakeIWH(rtc->width(), rtc->height()), HasAABloat::kNo,
      49           0 :                         IsZeroArea::kNo);
      50             : 
      51           0 :         fRenderTarget.reset(rtc->accessRenderTarget());
      52           0 :     }
      53             : 
      54           0 :     bool onCombineIfPossible(GrOp* that, const GrCaps& caps) override {
      55           0 :         return fRenderTarget.get() == that->cast<GrDiscardOp>()->fRenderTarget.get();
      56             :     }
      57             : 
      58           0 :     void onPrepare(GrOpFlushState*) override {}
      59             : 
      60           0 :     void onExecute(GrOpFlushState* state) override {
      61             :         // MDB TODO: instantiate the renderTarget from the proxy in here
      62           0 :         state->commandBuffer()->discard(fRenderTarget.get());
      63           0 :     }
      64             : 
      65             :     // MDB TODO: remove this. When the renderTargetProxy carries the refs this will be redundant.
      66             :     GrSurfaceProxy::UniqueID                             fProxyUniqueID;
      67             :     GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
      68             : 
      69             :     typedef GrOp INHERITED;
      70             : };
      71             : 
      72             : #endif

Generated by: LCOV version 1.13