• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 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 tessellate_StrokeHardwareTessellator_DEFINED
9 #define tessellate_StrokeHardwareTessellator_DEFINED
10 
11 #include "src/gpu/GrVertexChunkArray.h"
12 #include "src/gpu/tessellate/StrokeTessellator.h"
13 
14 namespace skgpu {
15 
16 // Renders opaque, constant-color strokes by decomposing them into standalone tessellation patches.
17 // Each patch is either a "cubic" (single stroked bezier curve with butt caps) or a "join". Requires
18 // MSAA if antialiasing is desired.
19 class StrokeHardwareTessellator : public StrokeTessellator {
20 public:
StrokeHardwareTessellator(PatchAttribs attribs)21     StrokeHardwareTessellator(PatchAttribs attribs) : StrokeTessellator(attribs) {}
22 
23     int prepare(GrMeshDrawTarget*,
24                 const SkMatrix& shaderMatrix,
25                 std::array<float,2> matrixMinMaxScales,
26                 PathStrokeList*,
27                 int totalCombinedVerbCnt) override;
28 #if SK_GPU_V1
29     void draw(GrOpFlushState*) const override;
30 #endif
31 
32 private:
33     GrVertexChunkArray fPatchChunks;
34 };
35 
36 }  // namespace skgpu
37 
38 #endif  // tessellate_StrokeHardwareTessellator_DEFINED
39