39#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
40 int numVerbs =
path.countVerbs();
41 if (numVerbs > 0 && !
path.isInverseFillType()) {
47 if (clippedDrawBounds.
intersect(drawBounds)) {
48 float gpuFragmentWork = clippedDrawBounds.
height() * clippedDrawBounds.
width();
49 float cpuTessellationWork = numVerbs *
SkNextLog2(numVerbs);
50 constexpr static float kCpuWeight = 512;
51 constexpr static float kMinNumPixelsToTriangulate = 256 * 256;
52 if (cpuTessellationWork * kCpuWeight + kMinNumPixelsToTriangulate < gpuFragmentWork) {
53 return GrOp::Make<skgpu::ganesh::PathInnerTriangulateOp>(rContext,
65 return GrOp::Make<skgpu::ganesh::PathStencilCoverOp>(
66 rContext, arena, viewMatrix,
path, std::move(
paint), aaType, fillPathFlags, drawBounds);
77bool ChopPathIfNecessary(
const SkMatrix& viewMatrix,
79 const SkIRect& clipConservativeBounds,
84 pathDevBounds.
width(),
93 float inflationRadius;
94 if (
stroke.isHairlineStyle()) {
103 viewport.
outset(inflationRadius, inflationRadius);
138 const CanDrawPathArgs&
args)
const {
142 args.fViewMatrix->hasPerspective() ||
144 !
args.fProxy->canUseStencil(*
args.fCaps)) {
161 if (
args.fHasUserStencilSettings) {
171 if (!ChopPathIfNecessary(*
args.fViewMatrix, shape, *
args.fClipConservativeBounds,
179bool TessellationPathRenderer::onDrawPath(
const DrawPathArgs&
args) {
180 auto sdc =
args.fSurfaceDrawContext;
187 *
args.fClipConservativeBounds,
188 args.fShape->style().strokeRec(), &
path));
191 if (!
args.fShape->style().isSimpleFill()) {
196 auto op = GrOp::Make<StrokeTessellateOp>(
args.fContext,
args.fAAType, *
args.fViewMatrix,
198 sdc->addDrawOp(
args.fClip, std::move(op));
203 const SkRect pathDevBounds =
args.fViewMatrix->mapRect(
args.fShape->bounds());
205 if (
path.isInverseFillType()) {
206 args.fSurfaceDrawContext->drawPaint(
args.fClip, std::move(
args.fPaint),
214 if (
path.isConvex() && !
path.isInverseFillType()) {
215 auto op = GrOp::Make<PathTessellateOp>(
args.fContext,
216 args.fSurfaceDrawContext->arenaAlloc(),
218 args.fUserStencilSettings,
221 std::move(
args.fPaint),
223 sdc->addDrawOp(
args.fClip, std::move(op));
228 const SkRect& drawBounds =
path.isInverseFillType()
229 ?
args.fSurfaceDrawContext->asSurfaceProxy()->backingStoreBoundsRect()
231 auto op = make_non_convex_fill_op(
args.fContext,
232 args.fSurfaceDrawContext->arenaAlloc(),
236 *
args.fClipConservativeBounds,
239 std::move(
args.fPaint));
240 sdc->addDrawOp(
args.fClip, std::move(op));
244void TessellationPathRenderer::onStencilPath(
const StencilPathArgs&
args) {
248 auto sdc =
args.fSurfaceDrawContext;
252 args.fViewMatrix->mapRect(&pathDevBounds,
args.fShape->bounds());
258 pathDevBounds.
width(),
266 if (
path.isConvex()) {
278 auto op = GrOp::Make<PathTessellateOp>(
args.fContext,
279 args.fSurfaceDrawContext->arenaAlloc(),
284 std::move(stencilPaint),
286 sdc->addDrawOp(
args.fClip, std::move(op));
290 auto op = make_non_convex_fill_op(
args.fContext,
291 args.fSurfaceDrawContext->arenaAlloc(),
295 *
args.fClipConservativeBounds,
299 sdc->addDrawOp(
args.fClip, std::move(op));
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static int SkNextLog2(uint32_t value)
bool avoidStencilBuffers() const
bool drawInstancedSupport() const
bool disableTessellationPathRenderer() const
static const GrDisableColorXPFactory * Get()
std::unique_ptr< GrOp > Owner
void setXPFactory(const GrXPFactory *xpFactory)
bool hasPathEffect() const
bool isSimpleFill() const
const SkStrokeRec & strokeRec() const
bool knownToBeConvex() const
bool inverseFilled() const
const GrStyle & style() const
uint32_t segmentMask() const
SkScalar getMaxScale() const
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
static SkScalar GetInflationRadius(const SkPaint &, SkPaint::Style)
SkScalar getWidth() const
@ kNoRestriction_StencilSupport
@ kNoSupport_StencilSupport
@ kStencilOnly_StencilSupport
static bool IsSupported(const GrCaps &)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
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
static constexpr GrUserStencilSettings kMarkStencil(GrUserStencilSettings::StaticInit< 0x0001, GrUserStencilTest::kLessIfInClip, 0x0000, GrUserStencilOp::kZero, GrUserStencilOp::kReplace, 0xffff >())
static constexpr float kMaxSegmentsPerCurve_p4
SkPath PreChopPathCurves(float tessellationPrecision, const SkPath &path, const SkMatrix &matrix, const SkRect &viewport)
static constexpr float kMaxSegmentsPerCurve
static constexpr float kPrecision
static constexpr Init< Ref, Test, TestMask, PassOp, FailOp, WriteMask > StaticInit()
static SkRect Make(const SkISize &size)
bool intersect(const SkRect &r)
void outset(float dx, float dy)
constexpr float height() const
constexpr float width() const