39static const char* ModeName(
Mode mode) {
41 case Mode::kWedgeMiddleOut:
42 return "MiddleOutShader (kWedges)";
43 case Mode::kCurveMiddleOut:
44 return "MiddleOutShader (kCurves)";
50class SamplePathTessellatorOp :
public GrDrawOp {
59 , fPipelineFlags(pipelineFlags)
61 this->setBounds(drawBounds, HasAABloat::kNo, IsHairline::kNo);
63 const char*
name()
const override {
return "SamplePathTessellatorOp"; }
65 FixedFunctionFlags fixedFunctionFlags()
const override {
66 return FixedFunctionFlags::kUsesHWAA;
72 nullptr, caps, clampType, &
color);
84 PathTessellator::PathDrawList pathList{pathMatrix,
fPath,
kCyan};
85 if (
fMode == Mode::kCurveMiddleOut) {
86#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
93 for (tess::PathMiddleOutFanIter it(
fPath); !it.done();) {
94 for (
auto [p0, p1, p2] : it.nextStack()) {
104 tess->prepareWithTriangles(flushState, shaderMatrix, &triangles, pathList,
109 tess->prepareWithTriangles(flushState, shaderMatrix,
nullptr, pathList,
116 fTessellator->prepare(flushState, shaderMatrix, pathList,
fPath.
countVerbs());
125 fTessellator->patchAttribs());
138 fTessellator->draw(flushState);
145 PathTessellator* fTessellator =
nullptr;
157 PathTessellatorsSlide() {
161 int numSides = 32 * 3;
162 for (
int i = 1;
i < numSides; ++
i) {
163 float theta = 2*3.1415926535897932384626433832785 *
i / numSides;
175 fName =
"PathTessellators";
184 bool onClick(Click*)
override;
190 float fConicWeight = .5;
205 error =
"TessellationPathRenderer not supported.";
207 if (!
error.isEmpty()) {
216 sdc->addDrawOp(GrOp::Make<SamplePathTessellatorOp>(ctx,
217 sdc->asRenderTargetProxy()->getBoundsRect(),
219 fPipelineFlags,
fMode));
231 caption.appendf(
" (w=%g)", fConicWeight);
243 Click(
int ptIdx) : fPtIdx(ptIdx) {}
259 if (fabs(
x - pts[
i].
x()) < fuzz && fabsf(
y - pts[
i].
y()) < fuzz) {
267 Click* myClick = (Click*)click;
268 myClick->doClick(&
fPath);
283 path_.
quadTo(pts[1], pts[2]);
286 path_.
cubicTo(pts[1], pts[2], pts[3]);
289 path_.
conicTo(pts[1], pts[2], (
w != 1) ?
w : .99f);
298bool PathTessellatorsSlide::onChar(
SkUnichar unichar) {
313 fConicWeight *= 5/4.f;
321 fConicWeight *= 4/5.f;
332DEF_SLIDE(
return new PathTessellatorsSlide; )
#define DEFINE_OP_CLASS_ID
std::function< void(GrSurfaceProxy *, skgpu::Mipmapped)> GrVisitProxyFunc
@ kSrcOver
r = s + (1-sa)*d
constexpr SkPMColor4f SK_PMColor4fWHITE
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorWHITE
@ kClose
SkPath::RawIter returns 0 points.
@ kCubic
SkPath::RawIter returns 4 points.
@ kConic
SkPath::RawIter returns 3 points + 1 weight.
@ kQuad
SkPath::RawIter returns 3 points.
@ kMove
SkPath::RawIter returns 1 point.
@ kLine
SkPath::RawIter returns 2 points.
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
const GrShaderCaps * shaderCaps() const
const GrDstProxyView & dstProxyView() const final
GrXferBarrierFlags renderPassBarriers() const final
SkArenaAlloc * allocator() override
const GrSurfaceProxyView & writeView() const final
const GrCaps & caps() const final
void bindPipeline(const GrProgramInfo &programInfo, const SkRect &drawBounds)
bool usesMSAASurface() const final
static GrPathTessellationShader * Make(const GrShaderCaps &, SkArenaAlloc *, const SkMatrix &viewMatrix, const SkPMColor4f &, PatchAttribs)
static const GrPipeline * CreatePipeline(const GrCaps *, SkArenaAlloc *, skgpu::Swizzle writeViewSwizzle, GrAppliedClip &&, const GrDstProxyView &, GrProcessorSet &&, GrPipeline::InputFlags pipelineFlags)
static GrProgramInfo * MakeProgram(const ProgramArgs &args, const GrTessellationShader *shader, const GrPipeline *pipeline, const GrUserStencilSettings *stencil)
void append(SkArenaAlloc *alloc, SkPoint a, SkPoint b, SkPoint c, int winding)
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
virtual GrRecordingContext * recordingContext() const
void clear(SkColor color)
SkMatrix getTotalMatrix() const
void setMatrix(const SkM44 &matrix)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
@ kPoints_PointMode
draw each point separately
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
SkPoint mapPoint(SkPoint pt) const
static const SkMatrix & I()
void setColor(SkColor color)
void setStrokeWidth(SkScalar width)
static void UpdatePathPoint(SkPath *path, int index, const SkPoint &pt)
static const SkPoint * PointData(const SkPath &path)
SkPath & moveTo(SkScalar x, SkScalar y)
SkPath & lineTo(SkScalar x, SkScalar y)
SkPath & quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
SkPath & cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
SkPath & conicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
void transform(const SkMatrix &matrix, SkPath *dst, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
void dump(SkWStream *stream, bool dumpAsHex) const
static PathCurveTessellator * Make(SkArenaAlloc *arena, bool infinitySupport, PatchAttribs attribs=PatchAttribs::kNone)
static PathWedgeTessellator * Make(SkArenaAlloc *arena, bool infinitySupport, PatchAttribs attribs=PatchAttribs::kNone)
static bool IsSupported(const GrCaps &)
const uint8_t uint32_t uint32_t GError ** error
constexpr SkColor4f kCyan
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
DEF_SWITCHES_START aot vmservice shared library name
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
font
Font Metadata and Metrics.
static TessellatorLibtess tess
SurfaceDrawContext * TopDeviceSurfaceDrawContext(const SkCanvas *canvas)
static const GrUserStencilSettings & kUnused