Flutter Engine
The Flutter Engine
Classes | Functions
GrStyledShape.cpp File Reference
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "include/core/SkArc.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPathEffect.h"
#include "include/core/SkPoint.h"
#include "include/core/SkStrokeRec.h"
#include "include/private/SkIDChangeListener.h"
#include "include/private/base/SkAlign.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkMalloc.h"
#include "include/private/base/SkTo.h"
#include <algorithm>
#include <cstring>
#include <utility>

Go to the source code of this file.

Classes

class  AutoRestoreInverseness
 

Functions

static bool is_inverted (bool originalIsInverted, GrStyledShape::FillInversion inversion)
 
static int path_key_from_data_size (const SkPath &path)
 
static void write_path_key_from_data (const SkPath &path, uint32_t *origKey)
 

Function Documentation

◆ is_inverted()

static bool is_inverted ( bool  originalIsInverted,
GrStyledShape::FillInversion  inversion 
)
static

Definition at line 42 of file GrStyledShape.cpp.

42 {
43 switch (inversion) {
45 return originalIsInverted;
47 return !originalIsInverted;
49 return true;
51 return false;
52 }
53 return false;
54}
static bool inversion(Vertex *prev, Vertex *next, Edge *origEdge, const Comparator &c)

◆ path_key_from_data_size()

static int path_key_from_data_size ( const SkPath path)
static

Definition at line 103 of file GrStyledShape.cpp.

103 {
104 const int verbCnt = path.countVerbs();
106 return -1;
107 }
108 const int pointCnt = path.countPoints();
109 const int conicWeightCnt = SkPathPriv::ConicWeightCnt(path);
110
111 static_assert(sizeof(SkPoint) == 2 * sizeof(uint32_t));
112 static_assert(sizeof(SkScalar) == sizeof(uint32_t));
113 // 1 is for the verb count. Each verb is a byte but we'll pad the verb data out to
114 // a uint32_t length.
115 return 1 + (SkAlign4(verbCnt) >> 2) + 2 * pointCnt + conicWeightCnt;
116}
static constexpr T SkAlign4(T x)
Definition: SkAlign.h:16
static constexpr int kMaxKeyFromDataVerbCnt
Definition: GrStyledShape.h:53
static int ConicWeightCnt(const SkPath &path)
Definition: SkPathPriv.h:208
float SkScalar
Definition: extension.cpp:12
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
Definition: switches.h:57

◆ write_path_key_from_data()

static void write_path_key_from_data ( const SkPath path,
uint32_t *  origKey 
)
static

Definition at line 119 of file GrStyledShape.cpp.

119 {
120 uint32_t* key = origKey;
121 // The check below should take care of negative values casted positive.
122 const int verbCnt = path.countVerbs();
123 const int pointCnt = path.countPoints();
124 const int conicWeightCnt = SkPathPriv::ConicWeightCnt(path);
126 SkASSERT(pointCnt && verbCnt);
127 *key++ = verbCnt;
128 memcpy(key, SkPathPriv::VerbData(path), verbCnt * sizeof(uint8_t));
129 int verbKeySize = SkAlign4(verbCnt);
130 // pad out to uint32_t alignment using value that will stand out when debugging.
131 uint8_t* pad = reinterpret_cast<uint8_t*>(key)+ verbCnt;
132 memset(pad, 0xDE, verbKeySize - verbCnt);
133 key += verbKeySize >> 2;
134
135 memcpy(key, SkPathPriv::PointData(path), sizeof(SkPoint) * pointCnt);
136 static_assert(sizeof(SkPoint) == 2 * sizeof(uint32_t));
137 key += 2 * pointCnt;
139 static_assert(sizeof(SkScalar) == sizeof(uint32_t));
140 SkDEBUGCODE(key += conicWeightCnt);
142}
static int path_key_from_data_size(const SkPath &path)
#define SkASSERT(cond)
Definition: SkAssert.h:116
static void * sk_careful_memcpy(void *dst, const void *src, size_t len)
Definition: SkMalloc.h:125
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
static const uint8_t * VerbData(const SkPath &path)
Definition: SkPathPriv.h:198
static const SkScalar * ConicWeightData(const SkPath &path)
Definition: SkPathPriv.h:213
static const SkPoint * PointData(const SkPath &path)
Definition: SkPathPriv.h:203