Flutter Engine
The Flutter Engine
PathRenderer.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
9
17#ifdef SK_DEBUG
19#endif
20
21namespace skgpu::ganesh {
22
23#ifdef SK_DEBUG
24void PathRenderer::StencilPathArgs::validate() const {
33 SkASSERT(!path.isInverseFillType());
34}
35#endif
36
37//////////////////////////////////////////////////////////////////////////////
38
41 SkDEBUGCODE(shape.asPath(&path);)
42 SkASSERT(shape.style().isSimpleFill());
43 SkASSERT(!path.isInverseFillType());
44 return this->onGetStencilSupport(shape);
45}
46
48#ifdef SK_DEBUG
49 args.validate();
50 CanDrawPathArgs canArgs;
51 canArgs.fCaps = args.fContext->priv().caps();
52 canArgs.fProxy = args.fSurfaceDrawContext->asRenderTargetProxy();
53 canArgs.fClipConservativeBounds = args.fClipConservativeBounds;
54 canArgs.fViewMatrix = args.fViewMatrix;
55 canArgs.fShape = args.fShape;
56 canArgs.fPaint = &args.fPaint;
57 canArgs.fSurfaceProps = &args.fSurfaceDrawContext->surfaceProps();
58 canArgs.fAAType = args.fAAType;
59 canArgs.validate();
60
61 canArgs.fHasUserStencilSettings = !args.fUserStencilSettings->isUnused();
62 SkASSERT(CanDrawPath::kNo != this->canDrawPath(canArgs));
63 if (!args.fUserStencilSettings->isUnused()) {
65 args.fShape->asPath(&path);
66 SkASSERT(args.fShape->style().isSimpleFill());
68 }
69#endif
70 return this->onDrawPath(args);
71}
72
74 SkISize devSize,
75 const SkMatrix& matrix,
76 SkRect* bounds) {
77 if (path.isInverseFillType()) {
78 *bounds = SkRect::Make(devSize);
79 return;
80 }
81 *bounds = path.getBounds();
82 matrix.mapRect(bounds);
83}
84
86 static constexpr GrUserStencilSettings kIncrementStencil(
88 0xffff,
90 0xffff,
93 0xffff>()
94 );
95
97 DrawPathArgs drawArgs{args.fContext,
98 std::move(paint),
99 &kIncrementStencil,
100 args.fSurfaceDrawContext,
101 nullptr, // clip
102 args.fClipConservativeBounds,
103 args.fViewMatrix,
104 args.fShape,
105 (GrAA::kYes == args.fDoStencilMSAA) ? GrAAType::kMSAA : GrAAType::kNone,
106 false};
107 this->drawPath(drawArgs);
108}
109
110} // namespace skgpu::ganesh
#define SkASSERT(cond)
Definition: SkAssert.h:116
const Context & fContext
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
bool isSimpleFill() const
Definition: GrStyle.h:114
void asPath(SkPath *out) const
const GrStyle & style() const
Definition: SkPath.h:59
bool drawPath(const DrawPathArgs &args)
virtual void onStencilPath(const StencilPathArgs &)
virtual StencilSupport onGetStencilSupport(const GrStyledShape &) const
Definition: PathRenderer.h:185
CanDrawPath canDrawPath(const CanDrawPathArgs &args) const
Definition: PathRenderer.h:113
StencilSupport getStencilSupport(const GrStyledShape &shape) const
static void GetPathDevBounds(const SkPath &path, SkISize devSize, const SkMatrix &matrix, SkRect *bounds)
virtual bool onDrawPath(const DrawPathArgs &args)=0
const Paint & paint
Definition: color_source.cc:38
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
Optional< SkRect > bounds
Definition: SkRecords.h:189
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
static constexpr Init< Ref, Test, TestMask, PassOp, FailOp, WriteMask > StaticInit()
Definition: SkSize.h:16
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669
const GrRenderTargetProxy * fProxy
Definition: PathRenderer.h:85