Flutter Engine
The Flutter Engine
Functions | Variables
GrPathUtils.cpp File Reference
#include "src/gpu/ganesh/geometry/GrPathUtils.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkRect.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkFloatingPoint.h"
#include "src/core/SkGeometry.h"
#include "src/core/SkPathEnums.h"
#include "src/core/SkPointPriv.h"
#include "src/gpu/tessellate/WangsFormula.h"
#include <algorithm>

Go to the source code of this file.

Functions

static float tolerance_to_wangs_precision (float srcTol)
 
uint32_t max_bezier_vertices (uint32_t chopCount)
 

Variables

static const SkScalar kMinCurveTol = 0.0001f
 

Function Documentation

◆ max_bezier_vertices()

uint32_t max_bezier_vertices ( uint32_t  chopCount)

Definition at line 35 of file GrPathUtils.cpp.

35 {
36 static constexpr uint32_t kMaxChopsPerCurve = 10;
37 static_assert((1 << kMaxChopsPerCurve) == GrPathUtils::kMaxPointsPerCurve);
38 return 1 << std::min(chopCount, kMaxChopsPerCurve);
39}
static float min(float r, float g, float b)
Definition: hsl.cpp:48
static const int kMaxPointsPerCurve
Definition: GrPathUtils.h:35

◆ tolerance_to_wangs_precision()

static float tolerance_to_wangs_precision ( float  srcTol)
static

Definition at line 25 of file GrPathUtils.cpp.

25 {
26 // You should have called scaleToleranceToSrc, which guarantees this
27 SkASSERT(srcTol >= kMinCurveTol);
28
29 // The GrPathUtil API defines tolerance as the max distance the linear segment can be from
30 // the real curve. Wang's formula guarantees the linear segments will be within 1/precision
31 // of the true curve, so precision = 1/srcTol
32 return 1.f / srcTol;
33}
static const SkScalar kMinCurveTol
Definition: GrPathUtils.cpp:23
#define SkASSERT(cond)
Definition: SkAssert.h:116

Variable Documentation

◆ kMinCurveTol

const SkScalar kMinCurveTol = 0.0001f
static

Definition at line 23 of file GrPathUtils.cpp.