41using StrokeWriter =
PatchWriter<VertexChunkPatchAllocator,
50void write_fixed_count_patches(StrokeWriter&& patchWriter,
59 if (!(patchWriter.attribs() & PatchAttribs::kStrokeParams)) {
61 patchWriter.updateUniformStrokeParams(pathStrokeList->fStroke);
64 for (
auto* pathStroke = pathStrokeList; pathStroke; pathStroke = pathStroke->fNext) {
66 if (patchWriter.attribs() & PatchAttribs::kStrokeParams) {
68 patchWriter.updateStrokeParamsAttrib(
stroke);
71 patchWriter.updateColorAttrib(pathStroke->fColor);
74 StrokeIterator strokeIter(pathStroke->fPath, &pathStroke->fStroke, &shaderMatrix);
75 while (strokeIter.next()) {
79 switch (strokeIter.verb()) {
80 case Verb::kContourFinished:
81 patchWriter.writeDeferredStrokePatch();
85 patchWriter.writeCircle(
p[0]);
87 case Verb::kMoveWithinContour:
90 patchWriter.updateJoinControlPointAttrib(
p[0]);
93 patchWriter.writeLine(
p[0],
p[1]);
99 patchWriter.writeCircle(cusp);
101 patchWriter.writeLine(
p[0], cusp);
102 patchWriter.writeLine(cusp,
p[2]);
104 patchWriter.writeQuadratic(
p);
112 patchWriter.writeCircle(cusp);
114 patchWriter.writeLine(
p[0], cusp);
115 patchWriter.writeLine(cusp,
p[2]);
117 patchWriter.writeConic(
p, strokeIter.w());
126 patchWriter.writeCubic(
p);
127 }
else if (numChops == 1) {
130 patchWriter.writeCircle(chops[3]);
133 chops[2] = chops[4] = chops[3];
135 patchWriter.writeCubic(chops);
136 patchWriter.writeCubic(chops + 3);
141 patchWriter.writeCircle(chops[3]);
142 patchWriter.writeCircle(chops[6]);
145 patchWriter.writeLine(chops[0], chops[3]);
146 patchWriter.writeLine(chops[3], chops[6]);
147 patchWriter.writeLine(chops[6], chops[9]);
149 patchWriter.writeCubic(chops);
150 patchWriter.writeCubic(chops + 3);
151 patchWriter.writeCubic(chops + 6);
168 int totalCombinedStrokeVerbCnt) {
173 write_fixed_count_patches(std::move(patchWriter), shaderMatrix, pathStrokeList);
176 if (!
target->caps().shaderCaps()->fVertexIDSupport) {
186 gVertexIDFallbackBufferKey,
#define SKGPU_DEFINE_STATIC_UNIQUE_KEY(name)
float SkFindQuadMidTangent(const SkPoint src[3])
void SkChopCubicAt(const SkPoint src[4], SkPoint dst[7], SkScalar t)
void SkEvalQuadAt(const SkPoint src[3], SkScalar t, SkPoint *pt, SkVector *tangent)
const GrShaderCaps * shaderCaps() const
void bindBuffers(sk_sp< const GrBuffer > indexBuffer, sk_sp< const GrBuffer > instanceBuffer, sk_sp< const GrBuffer > vertexBuffer, GrPrimitiveRestart primitiveRestart=GrPrimitiveRestart::kNo)
void drawInstanced(int instanceCount, int baseInstance, int vertexCount, int baseVertex)
const GrCaps & caps() const final
SkScalar getMaxScale() const
GrVertexChunkArray fVertexChunkArray
void draw(GrOpFlushState *) const
void prepare(GrMeshDrawTarget *, const SkMatrix &shaderMatrix, PathStrokeList *, int totalCombinedStrokeVerbCnt)
sk_sp< const GrGpuBuffer > fVertexBufferIfNoIDSupport
const PatchAttribs fAttribs
static constexpr int PreallocCount(int totalCombinedPathVerbCnt)
static void WriteVertexBuffer(VertexWriter, size_t bufferSize)
static constexpr int kMaxEdgesNoVertexIDs
static int VertexCount(const LinearTolerances &tolerances)
static constexpr size_t VertexBufferSize()
static float min(float r, float g, float b)
StrokeTessellator::PathStrokeList PathStrokeList
SKGPU_DECLARE_STATIC_UNIQUE_KEY(gUnitQuadBufferKey)
bool ConicHasCusp(const SkPoint p[3])
int FindCubicConvex180Chops(const SkPoint pts[], float T[2], bool *areCusps)
SIN Vec< N, float > abs(const Vec< N, float > &x)