/* * Copyright 2022 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef skgpu_tessellate_LinearTolerances_DEFINED #define skgpu_tessellate_LinearTolerances_DEFINED #include "include/core/SkScalar.h" #include "include/private/base/SkAssert.h" #include "src/gpu/tessellate/Tessellation.h" #include "src/gpu/tessellate/WangsFormula.h" #include <algorithm> namespace skgpu::tess { /** * LinearTolerances stores state to approximate the final device-space transform applied * to curves, and uses that to calculate segmentation levels for both the parametric curves and * radial components (when stroking, where you have to represent the offset of a curve). * These tolerances determine the worst-case number of parametric and radial segments required to * accurately linearize curves. * - segments = a linear subsection on the curve, either defined as parametric (linear in t) or * radial (linear in curve's internal rotation). * - edges = orthogonal geometry to segments, used in stroking to offset from the central curve by * half the stroke width, or to construct the join geometry. * * The tolerance values and decisions are estimated in the local path space, although PatchWriter * uses a 2x2 vector transform that approximates the scale/skew (as-best-as-possible) of the full * local-to-device transform applied in the vertex shader. * * The properties tracked in LinearTolerances can be used to compute the final segmentation factor * for filled paths (the resolve level) or stroked paths (the number of edges). */ class LinearTolerances { … }; } // namespace skgpu::tess #endif // skgpu_tessellate_LinearTolerances_DEFINED