Flutter Engine
The Flutter Engine
|
#include "src/gpu/ganesh/GrDistanceFieldGenFromVector.h"
#include "include/core/SkMatrix.h"
#include "include/private/base/SkTPin.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"
Go to the source code of this file.
Classes | |
struct | DFData |
class | DAffineMatrix |
class | PathSegment |
struct | RowData |
Typedefs | |
typedef TArray< PathSegment, true > | PathSegmentArray |
Enumerations | |
enum | SegSide { kLeft_SegSide = -1 , kOn_SegSide = 0 , kRight_SegSide = 1 , kNA_SegSide = 2 } |
Functions | |
static bool | between_closed_open (double a, double b, double c, double tolerance=0.0, bool xformToleranceToX=false) |
static bool | between_closed (double a, double b, double c, double tolerance=0.0, bool xformToleranceToX=false) |
static bool | nearly_zero (double x, double tolerance=kNearlyZero) |
static bool | nearly_equal (double x, double y, double tolerance=kNearlyZero, bool xformToleranceToX=false) |
static double | sign_of (const double &val) |
static bool | is_colinear (const SkPoint pts[3]) |
static void | init_distances (DFData *data, int size) |
static void | add_line (const SkPoint pts[2], PathSegmentArray *segments) |
static void | add_quad (const SkPoint pts[3], PathSegmentArray *segments) |
static void | add_cubic (const SkPoint pts[4], PathSegmentArray *segments) |
static float | calculate_nearest_point_for_quad (const PathSegment &segment, const DPoint &xFormPt) |
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) |
Variables | |
static const double | kClose = (SK_Scalar1 / 16.0) |
static const double | kCloseSqd = kClose * kClose |
static const double | kNearlyZero = (SK_Scalar1 / (1 << 18)) |
static const double | kTangentTolerance = (SK_Scalar1 / (1 << 11)) |
static const float | kConicTolerance = 0.25f |
typedef TArray<PathSegment, true> PathSegmentArray |
Definition at line 230 of file GrDistanceFieldGenFromVector.cpp.
enum SegSide |
If a scanline (a row of texel) cross from the kRight_SegSide of a segment to the kLeft_SegSide, the winding score should add 1. And winding score should subtract 1 if the scanline cross from kLeft_SegSide to kRight_SegSide. Always return kNA_SegSide if the scanline does not cross over the segment. Winding score should be zero in this case. You can get the winding number for each texel of the scanline by adding the winding score from left to right. Assuming we always start from outside, so the winding number should always start from zero.
| | | | ...R|L......L|R.....L|R......R|L..... <= Scanline & side of segment |+1 |-1 |-1 |+1 <= Winding score 0 | 1 ^ 0 ^ -1 |0 <= Winding number |________| |________|
.......NA................NA.......... 0 0
Enumerator | |
---|---|
kLeft_SegSide | |
kOn_SegSide | |
kRight_SegSide | |
kNA_SegSide |
Definition at line 61 of file GrDistanceFieldGenFromVector.cpp.
|
inlinestatic |
Definition at line 377 of file GrDistanceFieldGenFromVector.cpp.
|
inlinestatic |
|
inlinestatic |
Definition at line 356 of file GrDistanceFieldGenFromVector.cpp.
|
inlinestatic |
Definition at line 159 of file GrDistanceFieldGenFromVector.cpp.
|
inlinestatic |
Definition at line 136 of file GrDistanceFieldGenFromVector.cpp.
|
static |
Definition at line 624 of file GrDistanceFieldGenFromVector.cpp.
|
static |
Definition at line 387 of file GrDistanceFieldGenFromVector.cpp.
SegSide calculate_side_of_quad | ( | const PathSegment & | segment, |
const SkPoint & | point, | ||
const DPoint & | xFormPt, | ||
const RowData & | rowData | ||
) |
Definition at line 503 of file GrDistanceFieldGenFromVector.cpp.
|
static |
Definition at line 565 of file GrDistanceFieldGenFromVector.cpp.
bool GrGenerateDistanceFieldFromPath | ( | unsigned char * | distanceField, |
const SkPath & | path, | ||
const SkMatrix & | viewMatrix, | ||
int | width, | ||
int | height, | ||
size_t | rowBytes | ||
) |
Given a vector path, generate the associated distance field.
distanceField | The distance field to be generated. Should already be allocated by the client with the padding defined in "SkDistanceFieldGen.h". |
path | The path we're using to generate the distance field. |
matrix | Transformation matrix for path. |
width | Width of the distance field. |
height | Height of the distance field. |
rowBytes | Size of each row in the distance field, in bytes. |
Definition at line 721 of file GrDistanceFieldGenFromVector.cpp.
Definition at line 336 of file GrDistanceFieldGenFromVector.cpp.
|
static |
Definition at line 193 of file GrDistanceFieldGenFromVector.cpp.
|
inlinestatic |
Definition at line 179 of file GrDistanceFieldGenFromVector.cpp.
|
inlinestatic |
Definition at line 174 of file GrDistanceFieldGenFromVector.cpp.
|
static |
Definition at line 706 of file GrDistanceFieldGenFromVector.cpp.
void precomputation_for_row | ( | RowData * | rowData, |
const PathSegment & | segment, | ||
const SkPoint & | pointLeft, | ||
const SkPoint & | pointRight | ||
) |
Definition at line 450 of file GrDistanceFieldGenFromVector.cpp.
|
inlinestatic |
Definition at line 189 of file GrDistanceFieldGenFromVector.cpp.
|
static |
Definition at line 129 of file GrDistanceFieldGenFromVector.cpp.
|
static |
Definition at line 130 of file GrDistanceFieldGenFromVector.cpp.
|
static |
Definition at line 133 of file GrDistanceFieldGenFromVector.cpp.
|
static |
Definition at line 131 of file GrDistanceFieldGenFromVector.cpp.
|
static |
Definition at line 132 of file GrDistanceFieldGenFromVector.cpp.