Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
skgpu::ganesh::DefaultPathRenderer Class Referencefinal

#include <DefaultPathRenderer.h>

Inheritance diagram for skgpu::ganesh::DefaultPathRenderer:
skgpu::ganesh::PathRenderer SkRefCnt SkRefCntBase

Public Member Functions

 DefaultPathRenderer ()=default
 
const char * name () const override
 
- Public Member Functions inherited from skgpu::ganesh::PathRenderer
 PathRenderer ()=default
 
StencilSupport getStencilSupport (const GrStyledShape &shape) const
 
CanDrawPath canDrawPath (const CanDrawPathArgs &args) const
 
bool drawPath (const DrawPathArgs &args)
 
void stencilPath (const StencilPathArgs &args)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Private Member Functions

StencilSupport onGetStencilSupport (const GrStyledShape &) const override
 
CanDrawPath onCanDrawPath (const CanDrawPathArgs &) const override
 
bool onDrawPath (const DrawPathArgs &) override
 
void onStencilPath (const StencilPathArgs &) override
 

Additional Inherited Members

- Public Types inherited from skgpu::ganesh::PathRenderer
enum  StencilSupport { kNoSupport_StencilSupport , kStencilOnly_StencilSupport , kNoRestriction_StencilSupport }
 
enum class  CanDrawPath { kNo , kAsBackup , kYes }
 
- Static Protected Member Functions inherited from skgpu::ganesh::PathRenderer
static void GetPathDevBounds (const SkPath &path, SkISize devSize, const SkMatrix &matrix, SkRect *bounds)
 

Detailed Description

Subclass that renders the path using the stencil buffer to resolve fill rules (e.g. winding, even-odd)

Definition at line 19 of file DefaultPathRenderer.h.

Constructor & Destructor Documentation

◆ DefaultPathRenderer()

skgpu::ganesh::DefaultPathRenderer::DefaultPathRenderer ( )
default

Member Function Documentation

◆ name()

const char * skgpu::ganesh::DefaultPathRenderer::name ( ) const
inlineoverridevirtual

Implements skgpu::ganesh::PathRenderer.

Definition at line 23 of file DefaultPathRenderer.h.

23{ return "Default"; }

◆ onCanDrawPath()

PathRenderer::CanDrawPath skgpu::ganesh::DefaultPathRenderer::onCanDrawPath ( const CanDrawPathArgs args) const
overrideprivatevirtual

Subclass implementation of canDrawPath()

Implements skgpu::ganesh::PathRenderer.

Definition at line 774 of file DefaultPathRenderer.cpp.

774 {
775 bool isHairline = GrIsStrokeHairlineOrEquivalent(
776 args.fShape->style(), *args.fViewMatrix, nullptr);
777 // If we aren't a single_pass_shape or hairline, we require stencil buffers.
778 if (!(single_pass_shape(*args.fShape) || isHairline) &&
779 !args.fProxy->canUseStencil(*args.fCaps)) {
780 return CanDrawPath::kNo;
781 }
782 // If antialiasing is required, we only support MSAA.
783 if (GrAAType::kNone != args.fAAType && GrAAType::kMSAA != args.fAAType) {
784 return CanDrawPath::kNo;
785 }
786 // This can draw any path with any simple fill style.
787 if (!args.fShape->style().isSimpleFill() && !isHairline) {
788 return CanDrawPath::kNo;
789 }
790 // Don't try to draw hairlines with DefaultPathRenderer if avoidLineDraws is true.
791 // Alternatively, we could try to implement hairline draws without line primitives in
792 // DefaultPathRenderer, but this is simpler.
793 if (args.fCaps->avoidLineDraws() && isHairline) {
794 return CanDrawPath::kNo;
795 }
796 // This is the fallback renderer for when a path is too complicated for the others to draw.
798}
bool GrIsStrokeHairlineOrEquivalent(const GrStyle &style, const SkMatrix &matrix, SkScalar *outCoverage)
Definition GrUtil.cpp:65
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ onDrawPath()

bool skgpu::ganesh::DefaultPathRenderer::onDrawPath ( const DrawPathArgs args)
overrideprivatevirtual

Subclass implementation of drawPath()

Implements skgpu::ganesh::PathRenderer.

Definition at line 800 of file DefaultPathRenderer.cpp.

800 {
801 GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
802 "DefaultPathRenderer::onDrawPath");
803 GrAAType aaType = (GrAAType::kNone != args.fAAType) ? GrAAType::kMSAA : GrAAType::kNone;
804
805 return this->internalDrawPath(
806 args.fSurfaceDrawContext, std::move(args.fPaint), aaType, *args.fUserStencilSettings,
807 args.fClip, *args.fViewMatrix, *args.fShape, false);
808}
#define GR_AUDIT_TRAIL_AUTO_FRAME(audit_trail, framename)
GrAAType

◆ onGetStencilSupport()

PathRenderer::StencilSupport skgpu::ganesh::DefaultPathRenderer::onGetStencilSupport ( const GrStyledShape ) const
overrideprivatevirtual

Subclass overrides if it has any limitations of stenciling support.

Reimplemented from skgpu::ganesh::PathRenderer.

Definition at line 766 of file DefaultPathRenderer.cpp.

766 {
767 if (single_pass_shape(shape)) {
769 } else {
771 }
772}

◆ onStencilPath()

void skgpu::ganesh::DefaultPathRenderer::onStencilPath ( const StencilPathArgs args)
overrideprivatevirtual

Subclass implementation of stencilPath(). Subclass must override iff it ever returns kStencilOnly in onGetStencilSupport().

Reimplemented from skgpu::ganesh::PathRenderer.

Definition at line 810 of file DefaultPathRenderer.cpp.

810 {
811 GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
812 "DefaultPathRenderer::onStencilPath");
813 SkASSERT(!args.fShape->inverseFilled());
814
816 paint.setXPFactory(GrDisableColorXPFactory::Get());
817
818 auto aaType = (GrAA::kYes == args.fDoStencilMSAA) ? GrAAType::kMSAA : GrAAType::kNone;
819
820 this->internalDrawPath(
821 args.fSurfaceDrawContext, std::move(paint), aaType, GrUserStencilSettings::kUnused,
822 args.fClip, *args.fViewMatrix, *args.fShape, true);
823}
#define SkASSERT(cond)
Definition SkAssert.h:116
static const GrDisableColorXPFactory * Get()
const Paint & paint
static const GrUserStencilSettings & kUnused

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