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

#include <AALinearizingConvexPathRenderer.h>

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

Public Member Functions

 AALinearizingConvexPathRenderer ()=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
 
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 AALinearizingConvexPathRenderer.h.

Constructor & Destructor Documentation

◆ AALinearizingConvexPathRenderer()

skgpu::ganesh::AALinearizingConvexPathRenderer::AALinearizingConvexPathRenderer ( )
default

Member Function Documentation

◆ name()

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

Implements skgpu::ganesh::PathRenderer.

Definition at line 19 of file AALinearizingConvexPathRenderer.h.

19{ return "AALinear"; }

◆ onCanDrawPath()

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

Subclass implementation of canDrawPath()

Implements skgpu::ganesh::PathRenderer.

Definition at line 346 of file AALinearizingConvexPathRenderer.cpp.

346 {
347 if (GrAAType::kCoverage != args.fAAType) {
348 return CanDrawPath::kNo;
349 }
350 if (!args.fShape->knownToBeConvex()) {
351 return CanDrawPath::kNo;
352 }
353 if (args.fShape->style().pathEffect()) {
354 return CanDrawPath::kNo;
355 }
356 if (args.fShape->inverseFilled()) {
357 return CanDrawPath::kNo;
358 }
359 if (args.fShape->bounds().width() <= 0 && args.fShape->bounds().height() <= 0) {
360 // Stroked zero length lines should draw, but this PR doesn't handle that case
361 return CanDrawPath::kNo;
362 }
363 const SkStrokeRec& stroke = args.fShape->style().strokeRec();
364
365 if (stroke.getStyle() == SkStrokeRec::kStroke_Style ||
367 if (!args.fViewMatrix->isSimilarity()) {
368 return CanDrawPath::kNo;
369 }
370 SkScalar strokeWidth = args.fViewMatrix->getMaxScale() * stroke.getWidth();
371 if (strokeWidth < 1.0f && stroke.getStyle() == SkStrokeRec::kStroke_Style) {
372 return CanDrawPath::kNo;
373 }
374 if ((strokeWidth > kMaxStrokeWidth && !args.fShape->isRect()) ||
375 !args.fShape->knownToBeClosed() ||
377 return CanDrawPath::kNo;
378 }
379 return CanDrawPath::kYes;
380 }
381 if (stroke.getStyle() != SkStrokeRec::kFill_Style) {
382 return CanDrawPath::kNo;
383 }
384 // This can almost handle perspective. It would need to use 3 component explicit local coords
385 // when there are FPs that require them. This is difficult to test because AAConvexPathRenderer
386 // takes almost all filled paths that could get here. So just avoid perspective fills.
387 if (args.fViewMatrix->hasPerspective()) {
388 return CanDrawPath::kNo;
389 }
390 return CanDrawPath::kYes;
391}
static const int strokeWidth
Definition BlurTest.cpp:60
@ kRound_Join
adds circle
Definition SkPaint.h:360
Style getStyle() const
@ kStrokeAndFill_Style
Definition SkStrokeRec.h:36
SkScalar getWidth() const
Definition SkStrokeRec.h:42
SkPaint::Join getJoin() const
Definition SkStrokeRec.h:45
float SkScalar
Definition extension.cpp:12
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ onDrawPath()

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

Subclass implementation of drawPath()

Implements skgpu::ganesh::PathRenderer.

Definition at line 393 of file AALinearizingConvexPathRenderer.cpp.

393 {
394 GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
395 "AALinearizingConvexPathRenderer::onDrawPath");
396 SkASSERT(args.fSurfaceDrawContext->numSamples() <= 1);
397 SkASSERT(!args.fShape->isEmpty());
398 SkASSERT(!args.fShape->style().pathEffect());
399
400 SkPath path;
401 args.fShape->asPath(&path);
402 bool fill = args.fShape->style().isSimpleFill();
403 const SkStrokeRec& stroke = args.fShape->style().strokeRec();
404 SkScalar strokeWidth = fill ? -1.0f : stroke.getWidth();
406 SkScalar miterLimit = stroke.getMiter();
407
408 GrOp::Owner op = AAFlatteningConvexPathOp::Make(
409 args.fContext, std::move(args.fPaint), *args.fViewMatrix, path, strokeWidth,
410 stroke.getStyle(), join, miterLimit, args.fUserStencilSettings);
411 args.fSurfaceDrawContext->addDrawOp(args.fClip, std::move(op));
412 return true;
413}
#define GR_AUDIT_TRAIL_AUTO_FRAME(audit_trail, framename)
#define SkASSERT(cond)
Definition SkAssert.h:116
std::unique_ptr< GrOp > Owner
Definition GrOp.h:72
@ kMiter_Join
extends to miter limit
Definition SkPaint.h:359
SkScalar getMiter() const
Definition SkStrokeRec.h:43
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57
SINT Vec< 2 *N, T > join(const Vec< N, T > &lo, const Vec< N, T > &hi)
Definition SkVx.h:242

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