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

#include <DashLinePathRenderer.h>

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

Public Member Functions

 DashLinePathRenderer ()=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

CanDrawPath onCanDrawPath (const CanDrawPathArgs &) const override
 
StencilSupport onGetStencilSupport (const GrStyledShape &) const override
 
bool onDrawPath (const DrawPathArgs &) 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

Definition at line 15 of file DashLinePathRenderer.h.

Constructor & Destructor Documentation

◆ DashLinePathRenderer()

skgpu::ganesh::DashLinePathRenderer::DashLinePathRenderer ( )
default

Member Function Documentation

◆ name()

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

Implements skgpu::ganesh::PathRenderer.

Definition at line 19 of file DashLinePathRenderer.h.

19{ return "DashLine"; }

◆ onCanDrawPath()

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

Subclass implementation of canDrawPath()

Implements skgpu::ganesh::PathRenderer.

Definition at line 20 of file DashLinePathRenderer.cpp.

21 {
22 SkPoint pts[2];
23 bool inverted;
24 if (args.fShape->style().isDashed() && args.fShape->asLine(pts, &inverted)) {
25 // We should never have an inverse dashed case.
26 SkASSERT(!inverted);
27 if (!DashOp::CanDrawDashLine(pts, args.fShape->style(), *args.fViewMatrix)) {
28 return CanDrawPath::kNo;
29 }
30 return CanDrawPath::kYes;
31 }
32 return CanDrawPath::kNo;
33}
#define SkASSERT(cond)
Definition SkAssert.h:116
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
bool CanDrawDashLine(const SkPoint pts[2], const GrStyle &style, const SkMatrix &viewMatrix)
Definition DashOp.cpp:1190

◆ onDrawPath()

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

Subclass implementation of drawPath()

Implements skgpu::ganesh::PathRenderer.

Definition at line 35 of file DashLinePathRenderer.cpp.

35 {
36 GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
37 "DashLinePathRenderer::onDrawPath");
38 DashOp::AAMode aaMode;
39 switch (args.fAAType) {
40 case GrAAType::kNone:
41 aaMode = DashOp::AAMode::kNone;
42 break;
43 case GrAAType::kMSAA:
44 // In this mode we will use aa between dashes but the outer border uses MSAA. Otherwise,
45 // we can wind up with external edges antialiased and internal edges unantialiased.
46 aaMode = DashOp::AAMode::kCoverageWithMSAA;
47 break;
49 aaMode = DashOp::AAMode::kCoverage;
50 break;
51 }
52 SkPoint pts[2];
53 SkAssertResult(args.fShape->asLine(pts, nullptr));
54 GrOp::Owner op = DashOp::MakeDashLineOp(args.fContext, std::move(args.fPaint),
55 *args.fViewMatrix, pts, aaMode, args.fShape->style(),
56 args.fUserStencilSettings);
57 if (!op) {
58 return false;
59 }
60 args.fSurfaceDrawContext->addDrawOp(args.fClip, std::move(op));
61 return true;
62}
#define GR_AUDIT_TRAIL_AUTO_FRAME(audit_trail, framename)
#define SkAssertResult(cond)
Definition SkAssert.h:123
std::unique_ptr< GrOp > Owner
Definition GrOp.h:72
GrOp::Owner MakeDashLineOp(GrRecordingContext *context, GrPaint &&paint, const SkMatrix &viewMatrix, const SkPoint pts[2], AAMode aaMode, const GrStyle &style, const GrUserStencilSettings *stencilSettings)
Definition DashOp.cpp:1130

◆ onGetStencilSupport()

StencilSupport skgpu::ganesh::DashLinePathRenderer::onGetStencilSupport ( const GrStyledShape ) const
inlineoverrideprivatevirtual

Subclass overrides if it has any limitations of stenciling support.

Reimplemented from skgpu::ganesh::PathRenderer.

Definition at line 24 of file DashLinePathRenderer.h.


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