LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/gpu/ops - GrStencilPathOp.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 28 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 GrStencilPathOp_DEFINED
       9             : #define GrStencilPathOp_DEFINED
      10             : 
      11             : #include "GrGpu.h"
      12             : #include "GrOp.h"
      13             : #include "GrOpFlushState.h"
      14             : #include "GrPath.h"
      15             : #include "GrPathRendering.h"
      16             : #include "GrRenderTarget.h"
      17             : #include "GrStencilSettings.h"
      18             : 
      19           0 : class GrStencilPathOp final : public GrOp {
      20             : public:
      21           0 :     DEFINE_OP_CLASS_ID
      22             : 
      23             :     // MDB TODO: replace the renderTargetContext with just the renderTargetProxy.
      24             :     // For now, we need the renderTargetContext for its accessRenderTarget powers.
      25           0 :     static std::unique_ptr<GrOp> Make(const SkMatrix& viewMatrix,
      26             :                                       bool useHWAA,
      27             :                                       GrPathRendering::FillType fillType,
      28             :                                       bool hasStencilClip,
      29             :                                       int numStencilBits,
      30             :                                       const GrScissorState& scissor,
      31             :                                       GrRenderTargetContext* renderTargetContext,
      32             :                                       const GrPath* path) {
      33             : 
      34             :         // MDB TODO: remove this. In this hybrid state we need to be sure the RT is instantiable
      35             :         // so it can carry the IO refs. In the future we will just get the proxy and
      36             :         // it will carry the IO refs.
      37           0 :         if (!renderTargetContext->accessRenderTarget()) {
      38           0 :             return nullptr;
      39             :         }
      40             : 
      41             :         return std::unique_ptr<GrOp>(new GrStencilPathOp(viewMatrix, useHWAA, fillType,
      42             :                                                          hasStencilClip, numStencilBits, scissor,
      43           0 :                                                          renderTargetContext, path));
      44             :     }
      45             : 
      46           0 :     const char* name() const override { return "StencilPathOp"; }
      47             : 
      48           0 :     SkString dumpInfo() const override {
      49           0 :         SkString string;
      50           0 :         string.printf("Path: 0x%p, AA: %d", fPath.get(), fUseHWAA);
      51           0 :         string.appendf("rtID: %d proxyID: %d",
      52           0 :                        fRenderTarget.get()->uniqueID().asUInt(), fProxyUniqueID.asUInt());
      53           0 :         string.append(INHERITED::dumpInfo());
      54           0 :         return string;
      55             :     }
      56             : 
      57             : private:
      58           0 :     GrStencilPathOp(const SkMatrix& viewMatrix,
      59             :                     bool useHWAA,
      60             :                     GrPathRendering::FillType fillType,
      61             :                     bool hasStencilClip,
      62             :                     int numStencilBits,
      63             :                     const GrScissorState& scissor,
      64             :                     GrRenderTargetContext* renderTargetContext,
      65             :                     const GrPath* path)
      66           0 :             : INHERITED(ClassID())
      67             :             , fViewMatrix(viewMatrix)
      68             :             , fUseHWAA(useHWAA)
      69             :             , fStencil(GrPathRendering::GetStencilPassSettings(fillType), hasStencilClip,
      70             :                        numStencilBits)
      71             :             , fScissor(scissor)
      72           0 :             , fProxyUniqueID(renderTargetContext->asSurfaceProxy()->uniqueID())
      73           0 :             , fPath(path) {
      74           0 :         this->setBounds(path->getBounds(), HasAABloat::kNo, IsZeroArea::kNo);
      75             : 
      76           0 :         fRenderTarget.reset(renderTargetContext->accessRenderTarget());
      77           0 :     }
      78             : 
      79           0 :     bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override { return false; }
      80             : 
      81           0 :     void onPrepare(GrOpFlushState*) override {}
      82             : 
      83           0 :     void onExecute(GrOpFlushState* state) override {
      84             :         // MDB TODO: instantiate the renderTarget from the proxy in here
      85           0 :         GrPathRendering::StencilPathArgs args(fUseHWAA, fRenderTarget.get(), &fViewMatrix,
      86           0 :                                               &fScissor, &fStencil);
      87           0 :         state->gpu()->pathRendering()->stencilPath(args, fPath.get());
      88           0 :     }
      89             : 
      90             :     SkMatrix                                             fViewMatrix;
      91             :     bool                                                 fUseHWAA;
      92             :     GrStencilSettings                                    fStencil;
      93             :     GrScissorState                                       fScissor;
      94             :     // MDB TODO: remove this. When the renderTargetProxy carries the refs this will be redundant.
      95             :     GrSurfaceProxy::UniqueID                             fProxyUniqueID;
      96             :     GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
      97             :     GrPendingIOResource<const GrPath, kRead_GrIOType>    fPath;
      98             : 
      99             :     typedef GrOp INHERITED;
     100             : };
     101             : 
     102             : #endif

Generated by: LCOV version 1.13