• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 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 GrStrokeFixedCountTessellator_DEFINED
9 #define GrStrokeFixedCountTessellator_DEFINED
10 
11 #include "src/gpu/GrVertexChunkArray.h"
12 #include "src/gpu/tessellate/GrStrokeTessellator.h"
13 
14 // Renders strokes as fixed-count triangle strip instances. Any extra triangles not needed by the
15 // instance are emitted as degenerate triangles.
16 class GrStrokeFixedCountTessellator : public GrStrokeTessellator {
17 public:
GrStrokeFixedCountTessellator(ShaderFlags shaderFlags,const SkMatrix & viewMatrix,PathStrokeList * pathStrokeList)18     GrStrokeFixedCountTessellator(ShaderFlags shaderFlags, const SkMatrix& viewMatrix,
19                                   PathStrokeList* pathStrokeList)
20             : GrStrokeTessellator(GrStrokeTessellateShader::Mode::kFixedCount, shaderFlags,
21                                   viewMatrix, pathStrokeList) {
22     }
23 
24     void prepare(GrMeshDrawOp::Target*, int totalCombinedVerbCnt) override;
25     void draw(GrOpFlushState*) const override;
26 
27 private:
28     GrVertexChunkArray fInstanceChunks;
29     int fFixedVertexCount = 0;
30 };
31 
32 #endif
33