#include "src/gpu/ganesh/GrDistanceFieldGenFromVector.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPath.h"
#include "include/core/SkRect.h"
#include "include/core/SkScalar.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkPoint_impl.h"
#include "include/private/base/SkTArray.h"
#include "include/private/base/SkTPin.h"
#include "include/private/base/SkTemplates.h"
#include "src/base/SkAutoMalloc.h"
#include "src/core/SkDistanceFieldGen.h"
#include "src/core/SkGeometry.h"
#include "src/core/SkPathPriv.h"
#include "src/core/SkPointPriv.h"
#include "src/core/SkRectPriv.h"
#include "src/gpu/ganesh/geometry/GrPathUtils.h"
#include <algorithm>
#include <cmath>
usingnamespaceskia_private;
#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
namespace {
struct DPoint { … };
}
enum SegSide { … };
struct DFData { … };
class DAffineMatrix { … };
static const double kClose = …;
static const double kCloseSqd = …;
static const double kNearlyZero = …;
static const double kTangentTolerance = …;
static const float kConicTolerance = …;
static inline bool between_closed_open(double a, double b, double c,
double tolerance = 0.0,
bool xformToleranceToX = false) { … }
static inline bool between_closed(double a, double b, double c,
double tolerance = 0.0,
bool xformToleranceToX = false) { … }
static inline bool nearly_zero(double x, double tolerance = kNearlyZero) { … }
static inline bool nearly_equal(double x, double y,
double tolerance = kNearlyZero,
bool xformToleranceToX = false) { … }
static inline double sign_of(const double &val) { … }
static bool is_colinear(const SkPoint pts[3]) { … }
class PathSegment { … };
PathSegmentArray;
void PathSegment::init() { … }
static void init_distances(DFData* data, int size) { … }
static inline void add_line(const SkPoint pts[2], PathSegmentArray* segments) { … }
static inline void add_quad(const SkPoint pts[3], PathSegmentArray* segments) { … }
static inline void add_cubic(const SkPoint pts[4],
PathSegmentArray* segments) { … }
static float calculate_nearest_point_for_quad(
const PathSegment& segment,
const DPoint &xFormPt) { … }
struct RowData { … };
void precomputation_for_row(RowData *rowData, const PathSegment& segment,
const SkPoint& pointLeft, const SkPoint& pointRight) { … }
SegSide calculate_side_of_quad(
const PathSegment& segment,
const SkPoint& point,
const DPoint& xFormPt,
const RowData& rowData) { … }
static float distance_to_segment(const SkPoint& point,
const PathSegment& segment,
const RowData& rowData,
SegSide* side) { … }
static void calculate_distance_field_data(PathSegmentArray* segments,
DFData* dataPtr,
int width, int height) { … }
template <int distanceMagnitude>
static unsigned char pack_distance_field_val(float dist) { … }
bool GrGenerateDistanceFieldFromPath(unsigned char* distanceField,
const SkPath& path, const SkMatrix& drawMatrix,
int width, int height, size_t rowBytes) { … }
#endif