Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
StrokeTessellator.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 Google LLC
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
8#ifndef StrokeTessellator_DEFINED
9#define StrokeTessellator_DEFINED
10
11#include "include/core/SkPath.h"
18
20class GrOpFlushState;
21class SkMatrix;
22
23namespace skgpu::ganesh {
24
25// Prepares GPU data for, and then draws a stroke's tessellated geometry. Renders strokes as
26// fixed-count triangle strip instances. Any extra triangles not needed by the instance are emitted
27// as degenerate triangles.
29public:
31
40
42
43 // Called before draw(). Prepares GPU buffers containing the geometry to tessellate.
44 //
45 // Returns the fixed number of edges the tessellator will draw per patch.
47 const SkMatrix& shaderMatrix,
49 int totalCombinedStrokeVerbCnt);
50
51 // Issues draw calls for the tessellated stroke. The caller is responsible for creating and
52 // binding a pipeline that uses this class's shader() before calling draw().
53 void draw(GrOpFlushState*) const;
54
55protected:
57
59
60 int fVertexCount = 0;
61
62 // Only used if sk_VertexID is not supported.
64};
65
66} // namespace skgpu::ganesh
67
68#endif // StrokeTessellator_DEFINED
SkColor4f color
StrokeTessellator(PatchAttribs attribs)
void draw(GrOpFlushState *) const
void prepare(GrMeshDrawTarget *, const SkMatrix &shaderMatrix, PathStrokeList *, int totalCombinedStrokeVerbCnt)
sk_sp< const GrGpuBuffer > fVertexBufferIfNoIDSupport
PathStrokeList(const SkPath &path, const SkStrokeRec &stroke, const SkPMColor4f &color)