Flutter Engine
The Flutter Engine
Static Public Member Functions | Static Public Attributes | List of all members
skgpu::tess::FixedCountStrokes Class Reference

#include <FixedCountBufferUtils.h>

Static Public Member Functions

static constexpr int PreallocCount (int totalCombinedPathVerbCnt)
 
static int VertexCount (const LinearTolerances &tolerances)
 
static constexpr size_t VertexBufferSize ()
 
static void WriteVertexBuffer (VertexWriter, size_t bufferSize)
 

Static Public Attributes

static constexpr int kMaxEdges = (1 << 14) - 1
 
static constexpr int kMaxEdgesNoVertexIDs = 1024
 

Detailed Description

Definition at line 106 of file FixedCountBufferUtils.h.

Member Function Documentation

◆ PreallocCount()

static constexpr int skgpu::tess::FixedCountStrokes::PreallocCount ( int  totalCombinedPathVerbCnt)
inlinestaticconstexpr

Definition at line 123 of file FixedCountBufferUtils.h.

123 {
124 // Over-allocate enough patches for each stroke to chop once, and for 8 extra caps. Since
125 // we have to chop at inflections, points of 180 degree rotation, and anywhere a stroke
126 // requires too many parametric segments, many strokes will end up getting choppped.
127 return (totalCombinedPathVerbCnt * 2) + 8/* caps */;
128 }

◆ VertexBufferSize()

static constexpr size_t skgpu::tess::FixedCountStrokes::VertexBufferSize ( )
inlinestaticconstexpr

Definition at line 135 of file FixedCountBufferUtils.h.

135 {
136 // Each vertex is a single float (explicit id) and each edge is composed of two vertices.
137 return 2 * kMaxEdgesNoVertexIDs * sizeof(float);
138 }
static constexpr int kMaxEdgesNoVertexIDs

◆ VertexCount()

static int skgpu::tess::FixedCountStrokes::VertexCount ( const LinearTolerances tolerances)
inlinestatic

Definition at line 131 of file FixedCountBufferUtils.h.

131 {
132 return std::min(tolerances.requiredStrokeEdges(), kMaxEdges) * 2;
133 }
static float min(float r, float g, float b)
Definition: hsl.cpp:48

◆ WriteVertexBuffer()

void skgpu::tess::FixedCountStrokes::WriteVertexBuffer ( VertexWriter  vertexWriter,
size_t  bufferSize 
)
static

Definition at line 129 of file FixedCountBufferUtils.cpp.

129 {
130 int edgeCount = bufferSize / (sizeof(float) * 2);
131 for (int i = 0; i < edgeCount; ++i) {
132 vertexWriter << (float)i << (float)-i;
133 }
134}

Member Data Documentation

◆ kMaxEdges

constexpr int skgpu::tess::FixedCountStrokes::kMaxEdges = (1 << 14) - 1
staticconstexpr

Definition at line 120 of file FixedCountBufferUtils.h.

◆ kMaxEdgesNoVertexIDs

constexpr int skgpu::tess::FixedCountStrokes::kMaxEdgesNoVertexIDs = 1024
staticconstexpr

Definition at line 121 of file FixedCountBufferUtils.h.


The documentation for this class was generated from the following files: