Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
SkPathOpsWinding.cpp File Reference
#include "include/core/SkPath.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkScalar.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkMalloc.h"
#include "include/private/base/SkMath.h"
#include "include/private/base/SkTArray.h"
#include "src/base/SkArenaAlloc.h"
#include "src/base/SkTSort.h"
#include "src/pathops/SkOpContour.h"
#include "src/pathops/SkOpSegment.h"
#include "src/pathops/SkOpSpan.h"
#include "src/pathops/SkPathOpsBounds.h"
#include "src/pathops/SkPathOpsCurve.h"
#include "src/pathops/SkPathOpsPoint.h"
#include "src/pathops/SkPathOpsTypes.h"
#include <cmath>
#include <utility>

Go to the source code of this file.

Classes

struct  SkOpRayHit
 

Enumerations

enum class  SkOpRayDir { kLeft , kTop , kRight , kBottom }
 

Functions

static int xy_index (SkOpRayDir dir)
 
static SkScalar pt_xy (const SkPoint &pt, SkOpRayDir dir)
 
static SkScalar pt_yx (const SkPoint &pt, SkOpRayDir dir)
 
static double pt_dxdy (const SkDVector &v, SkOpRayDir dir)
 
static double pt_dydx (const SkDVector &v, SkOpRayDir dir)
 
static SkScalar rect_side (const SkRect &r, SkOpRayDir dir)
 
static bool sideways_overlap (const SkRect &rect, const SkPoint &pt, SkOpRayDir dir)
 
static bool less_than (SkOpRayDir dir)
 
static bool ccw_dxdy (const SkDVector &v, SkOpRayDir dir)
 
static bool hit_compare_x (const SkOpRayHit *a, const SkOpRayHit *b)
 
static bool reverse_hit_compare_x (const SkOpRayHit *a, const SkOpRayHit *b)
 
static bool hit_compare_y (const SkOpRayHit *a, const SkOpRayHit *b)
 
static bool reverse_hit_compare_y (const SkOpRayHit *a, const SkOpRayHit *b)
 
static double get_t_guess (int tTry, int *dirOffset)
 
SkOpSpanFindSortableTop (SkOpContourHead *contourHead)
 

Enumeration Type Documentation

◆ SkOpRayDir

enum class SkOpRayDir
strong
Enumerator
kLeft 
kTop 
kRight 
kBottom 

Definition at line 48 of file SkPathOpsWinding.cpp.

48 {
49 kLeft,
50 kTop,
51 kRight,
52 kBottom,
53};

Function Documentation

◆ ccw_dxdy()

static bool ccw_dxdy ( const SkDVector v,
SkOpRayDir  dir 
)
static

Definition at line 97 of file SkPathOpsWinding.cpp.

97 {
98 bool vPartPos = pt_dydx(v, dir) > 0;
99 bool leftBottom = ((static_cast<int>(dir) + 1) & 2) != 0;
100 return vPartPos == leftBottom;
101}
static double pt_dydx(const SkDVector &v, SkOpRayDir dir)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
Definition switches.h:145

◆ FindSortableTop()

SkOpSpan * FindSortableTop ( SkOpContourHead contourHead)

Definition at line 429 of file SkPathOpsWinding.cpp.

429 {
430 for (int index = 0; index < SkOpGlobalState::kMaxWindingTries; ++index) {
431 SkOpContour* contour = contourHead;
432 do {
433 if (contour->done()) {
434 continue;
435 }
436 SkOpSpan* result = contour->findSortableTop(contourHead);
437 if (result) {
438 return result;
439 }
440 } while ((contour = contour->next()));
441 }
442 return nullptr;
443}
GAsyncResult * result

◆ get_t_guess()

static double get_t_guess ( int  tTry,
int dirOffset 
)
static

Definition at line 239 of file SkPathOpsWinding.cpp.

239 {
240 double t = 0.5;
241 *dirOffset = tTry & 1;
242 int tBase = tTry >> 1;
243 int tBits = 0;
244 while (tTry >>= 1) {
245 t /= 2;
246 ++tBits;
247 }
248 if (tBits) {
249 int tIndex = (tBase - 1) & ((1 << tBits) - 1);
250 t += t * 2 * tIndex;
251 }
252 return t;
253}

◆ hit_compare_x()

static bool hit_compare_x ( const SkOpRayHit a,
const SkOpRayHit b 
)
static

Definition at line 223 of file SkPathOpsWinding.cpp.

223 {
224 return a->fPt.fX < b->fPt.fX;
225}
static bool b
struct MyStruct a[10]

◆ hit_compare_y()

static bool hit_compare_y ( const SkOpRayHit a,
const SkOpRayHit b 
)
static

Definition at line 231 of file SkPathOpsWinding.cpp.

231 {
232 return a->fPt.fY < b->fPt.fY;
233}

◆ less_than()

static bool less_than ( SkOpRayDir  dir)
static

Definition at line 93 of file SkPathOpsWinding.cpp.

93 {
94 return static_cast<bool>((static_cast<int>(dir) & 2) == 0);
95}

◆ pt_dxdy()

static double pt_dxdy ( const SkDVector v,
SkOpRayDir  dir 
)
static

Definition at line 76 of file SkPathOpsWinding.cpp.

76 {
77 return (&v.fX)[xy_index(dir)];
78}
static int xy_index(SkOpRayDir dir)

◆ pt_dydx()

static double pt_dydx ( const SkDVector v,
SkOpRayDir  dir 
)
static

Definition at line 80 of file SkPathOpsWinding.cpp.

80 {
81 return (&v.fX)[!xy_index(dir)];
82}

◆ pt_xy()

static SkScalar pt_xy ( const SkPoint pt,
SkOpRayDir  dir 
)
static

Definition at line 68 of file SkPathOpsWinding.cpp.

68 {
69 return (&pt.fX)[xy_index(dir)];
70}
float fX
x-axis value

◆ pt_yx()

static SkScalar pt_yx ( const SkPoint pt,
SkOpRayDir  dir 
)
static

Definition at line 72 of file SkPathOpsWinding.cpp.

72 {
73 return (&pt.fX)[!xy_index(dir)];
74}

◆ rect_side()

static SkScalar rect_side ( const SkRect r,
SkOpRayDir  dir 
)
static

Definition at line 84 of file SkPathOpsWinding.cpp.

84 {
85 return (&r.fLeft)[static_cast<int>(dir)];
86}
SkScalar fLeft
smaller x-axis bounds
Definition extension.cpp:14

◆ reverse_hit_compare_x()

static bool reverse_hit_compare_x ( const SkOpRayHit a,
const SkOpRayHit b 
)
static

Definition at line 227 of file SkPathOpsWinding.cpp.

227 {
228 return b->fPt.fX < a->fPt.fX;
229}

◆ reverse_hit_compare_y()

static bool reverse_hit_compare_y ( const SkOpRayHit a,
const SkOpRayHit b 
)
static

Definition at line 235 of file SkPathOpsWinding.cpp.

235 {
236 return b->fPt.fY < a->fPt.fY;
237}

◆ sideways_overlap()

static bool sideways_overlap ( const SkRect rect,
const SkPoint pt,
SkOpRayDir  dir 
)
static

Definition at line 88 of file SkPathOpsWinding.cpp.

88 {
89 int i = !xy_index(dir);
90 return approximately_between((&rect.fLeft)[i], (&pt.fX)[i], (&rect.fRight)[i]);
91}
bool approximately_between(double a, double b, double c)
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350

◆ xy_index()

static int xy_index ( SkOpRayDir  dir)
static

Definition at line 64 of file SkPathOpsWinding.cpp.

64 {
65 return static_cast<int>(dir) & 1;
66}