Skia
2DGraphicsLibrary
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GrClip Class Referenceabstract

GrClip is an abstract base class for applying a clip. More...

#include <GrClip.h>

Inheritance diagram for GrClip:
GrNoClip

Public Member Functions

virtual bool quickContains (const SkRect &) const =0
 
virtual bool quickContains (const SkRRect &rrect) const
 
virtual void getConservativeBounds (int width, int height, SkIRect *devResult, bool *isIntersectionOfRects=nullptr) const =0
 
virtual bool apply (GrContext *, GrDrawContext *, bool useHWAA, bool hasUserStencilSettings, GrAppliedClip *out) const =0
 

Static Public Member Functions

template<typename TRect >
static constexpr bool IsInsideClip (const TRect &innerClipBounds, const SkRect &queryBounds)
 Returns true if the given query bounds count as entirely inside the clip. More...
 
template<typename TRect >
static constexpr bool IsOutsideClip (const TRect &outerClipBounds, const SkRect &queryBounds)
 Returns true if the given query bounds count as entirely outside the clip. More...
 
static SkIRect GetPixelIBounds (const SkRect &bounds)
 Returns the minimal integer rect that counts as containing a given set of bounds.
 
static SkRect GetPixelBounds (const SkRect &bounds)
 Returns the minimal pixel-aligned rect that counts as containing a given set of bounds.
 
static bool IsPixelAligned (const SkRect &rect)
 Returns true if the given rect counts as aligned with pixel boundaries.
 

Static Public Attributes

static constexpr SkScalar kBoundsTolerance = 1e-3f
 This is the maximum distance that a draw may extend beyond a clip's boundary and still count count as "on the other side". More...
 

Detailed Description

GrClip is an abstract base class for applying a clip.

It constructs a clip mask if necessary, and fills out a GrAppliedClip instructing the caller on how to set up the draw state.

Member Function Documentation

template<typename TRect >
static constexpr bool GrClip::IsInsideClip ( const TRect &  innerClipBounds,
const SkRect queryBounds 
)
inlinestatic

Returns true if the given query bounds count as entirely inside the clip.

Parameters
innerClipBoundsdevice-space rect contained by the clip (SkRect or SkIRect).
queryBoundsdevice-space bounds of the query region.
template<typename TRect >
static constexpr bool GrClip::IsOutsideClip ( const TRect &  outerClipBounds,
const SkRect queryBounds 
)
inlinestatic

Returns true if the given query bounds count as entirely outside the clip.

Parameters
outerClipBoundsdevice-space rect that contains the clip (SkRect or SkIRect).
queryBoundsdevice-space bounds of the query region.

Member Data Documentation

constexpr SkScalar GrClip::kBoundsTolerance = 1e-3f
static

This is the maximum distance that a draw may extend beyond a clip's boundary and still count count as "on the other side".

We leave some slack because floating point rounding error is likely to blame. The rationale for 1e-3 is that in the coverage case (and barring unexpected rounding), as long as coverage stays within 0.5 * 1/256 of its intended value it shouldn't have any effect on the final pixel values.


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