Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
GrHardClip Class Referenceabstract

#include <GrClip.h>

Inheritance diagram for GrHardClip:
GrClip GrFixedClip skgpu::ganesh::StencilClip

Public Member Functions

virtual Effect apply (GrAppliedHardClip *out, SkIRect *bounds) const =0
 
- Public Member Functions inherited from GrClip
virtual ~GrClip ()
 
virtual SkIRect getConservativeBounds () const =0
 
virtual PreClipResult preApply (const SkRect &drawBounds, GrAA aa) const
 

Private Member Functions

Effect apply (GrRecordingContext *, skgpu::ganesh::SurfaceDrawContext *, GrDrawOp *, GrAAType aa, GrAppliedClip *out, SkRect *bounds) const final
 

Additional Inherited Members

- Public Types inherited from GrClip
enum class  Effect { kClipped , kUnclipped , kClippedOut }
 
enum class  BoundsType { kExterior , kInterior }
 
- Static Public Member Functions inherited from GrClip
static bool IsInsideClip (const SkIRect &innerClipBounds, const SkRect &drawBounds, GrAA aa)
 
static bool IsOutsideClip (const SkIRect &outerClipBounds, const SkRect &drawBounds, GrAA aa)
 
static SkIRect GetPixelIBounds (const SkRect &bounds, GrAA aa, BoundsType mode=BoundsType::kExterior)
 
static bool IsPixelAligned (const SkRect &rect)
 
- Static Public Attributes inherited from GrClip
static constexpr SkScalar kBoundsTolerance = 1e-3f
 
static constexpr SkScalar kHalfPixelRoundingTolerance = 5e-2f
 

Detailed Description

GrHardClip never uses coverage FPs. It can only enforce the clip using the already-existing stencil buffer contents and/or fixed-function state like scissor. Always aliased if MSAA is off.

Definition at line 215 of file GrClip.h.

Member Function Documentation

◆ apply() [1/2]

virtual Effect GrHardClip::apply ( GrAppliedHardClip out,
SkIRect bounds 
) const
pure virtual

Sets the appropriate hardware state modifications on GrAppliedHardClip that will implement the clip. On input 'bounds' is a conservative bounds of the draw that is to be clipped. After return 'bounds' has been intersected with a conservative bounds of the clip.

Implemented in GrFixedClip, and skgpu::ganesh::StencilClip.

◆ apply() [2/2]

Effect GrHardClip::apply ( GrRecordingContext ,
skgpu::ganesh::SurfaceDrawContext ,
GrDrawOp ,
GrAAType  ,
GrAppliedClip ,
SkRect bounds 
) const
inlinefinalprivatevirtual

This computes a GrAppliedClip from the clip which in turn can be used to build a GrPipeline. To determine the appropriate clipping implementation the GrClip subclass must know whether the draw will enable HW AA or uses the stencil buffer. On input 'bounds' is a conservative bounds of the draw that is to be clipped. If kClipped or kUnclipped is returned, the 'bounds' will have been updated to be contained within the clip bounds (or the device's, for wide-open clips). If kNoDraw is returned, 'bounds' and the applied clip are in an undetermined state and should be ignored (and the draw should be skipped).

Implements GrClip.

Definition at line 225 of file GrClip.h.

230 {
231 SkIRect pixelBounds = GetPixelIBounds(*bounds, GrAA(aa != GrAAType::kNone));
232 Effect effect = this->apply(&out->hardClip(), &pixelBounds);
233 bounds->intersect(SkRect::Make(pixelBounds));
234 return effect;
235 }
GrAA
static SkIRect GetPixelIBounds(const SkRect &bounds, GrAA aa, BoundsType mode=BoundsType::kExterior)
Definition GrClip.h:173
virtual Effect apply(GrAppliedHardClip *out, SkIRect *bounds) const =0
Optional< SkRect > bounds
Definition SkRecords.h:189
static SkRect Make(const SkISize &size)
Definition SkRect.h:669

The documentation for this class was generated from the following file: