Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
DashLinePathRenderer.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2015 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
18namespace skgpu::ganesh {
19
21 const CanDrawPathArgs& args) const {
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}
34
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}
63
64} // namespace skgpu::ganesh
#define GR_AUDIT_TRAIL_AUTO_FRAME(audit_trail, framename)
#define SkAssertResult(cond)
Definition SkAssert.h:123
#define SkASSERT(cond)
Definition SkAssert.h:116
std::unique_ptr< GrOp > Owner
Definition GrOp.h:72
bool onDrawPath(const DrawPathArgs &) override
CanDrawPath onCanDrawPath(const CanDrawPathArgs &) const override
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
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
bool CanDrawDashLine(const SkPoint pts[2], const GrStyle &style, const SkMatrix &viewMatrix)
Definition DashOp.cpp:1190