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

          Line data    Source code
       1             : /*
       2             :  * Copyright 2016 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 GrAppliedClip_DEFINED
       9             : #define GrAppliedClip_DEFINED
      10             : 
      11             : #include "GrFragmentProcessor.h"
      12             : #include "GrScissorState.h"
      13             : #include "GrWindowRectsState.h"
      14             : 
      15             : /**
      16             :  * Produced by GrClip. It provides a set of modifications to the drawing state that are used to
      17             :  * create the final GrPipeline for a GrOp.
      18             :  */
      19           0 : class GrAppliedClip {
      20             : public:
      21           0 :     GrAppliedClip() = default;
      22           0 :     GrAppliedClip(GrAppliedClip&& that) = default;
      23             :     GrAppliedClip(const GrAppliedClip&) = delete;
      24             : 
      25           0 :     const GrScissorState& scissorState() const { return fScissorState; }
      26           0 :     const GrWindowRectsState& windowRectsState() const { return fWindowRectsState; }
      27           0 :     GrFragmentProcessor* clipCoverageFragmentProcessor() const { return fClipCoverageFP.get(); }
      28           0 :     bool hasStencilClip() const { return fHasStencilClip; }
      29             : 
      30             :     /**
      31             :      * Intersects the applied clip with the provided rect. Returns false if the draw became empty.
      32             :      * 'clippedDrawBounds' will be intersected with 'irect'. This returns false if the clip becomes
      33             :      * empty or the draw no longer intersects the clip. In either case the draw can be skipped.
      34             :      */
      35           0 :     bool addScissor(const SkIRect& irect, SkRect* clippedDrawBounds) {
      36           0 :         return fScissorState.intersect(irect) && clippedDrawBounds->intersect(SkRect::Make(irect));
      37             :     }
      38             : 
      39           0 :     void addWindowRectangles(const GrWindowRectsState& windowState) {
      40           0 :         SkASSERT(!fWindowRectsState.enabled());
      41           0 :         fWindowRectsState = windowState;
      42           0 :     }
      43             : 
      44           0 :     void addWindowRectangles(const GrWindowRectangles& windows, GrWindowRectsState::Mode mode) {
      45           0 :         SkASSERT(!fWindowRectsState.enabled());
      46           0 :         fWindowRectsState.set(windows, mode);
      47           0 :     }
      48             : 
      49           0 :     void addCoverageFP(sk_sp<GrFragmentProcessor> fp) {
      50           0 :         SkASSERT(!fClipCoverageFP);
      51           0 :         fClipCoverageFP = fp;
      52           0 :     }
      53             : 
      54           0 :     void addStencilClip() {
      55           0 :         SkASSERT(!fHasStencilClip);
      56           0 :         fHasStencilClip = true;
      57           0 :     }
      58             : 
      59           0 :     bool doesClip() const {
      60           0 :         return fScissorState.enabled() || fClipCoverageFP || fHasStencilClip ||
      61           0 :                fWindowRectsState.enabled();
      62             :     }
      63             : 
      64           0 :     bool operator==(const GrAppliedClip& that) const {
      65           0 :         if (fScissorState != that.fScissorState || fHasStencilClip != that.fHasStencilClip) {
      66           0 :             return false;
      67             :         }
      68           0 :         if (SkToBool(fClipCoverageFP)) {
      69           0 :             if (!SkToBool(that.fClipCoverageFP) ||
      70           0 :                 !that.fClipCoverageFP->isEqual(*fClipCoverageFP)) {
      71           0 :                 return false;
      72             :             }
      73           0 :         } else if (SkToBool(that.fClipCoverageFP)) {
      74           0 :             return false;
      75             :         }
      76           0 :         return fWindowRectsState == that.fWindowRectsState;
      77             :     }
      78           0 :     bool operator!=(const GrAppliedClip& that) const { return !(*this == that); }
      79             : 
      80             : private:
      81             :     GrScissorState             fScissorState;
      82             :     GrWindowRectsState         fWindowRectsState;
      83             :     sk_sp<GrFragmentProcessor> fClipCoverageFP;
      84             :     bool                       fHasStencilClip = false;
      85             : };
      86             : 
      87             : #endif

Generated by: LCOV version 1.13