19constexpr int kMaxKeyFromDataVerbCnt = 10;
25 switch (shape.
type()) {
33 fInverted = shape.fInverted;
94 return builder.detach();
99 const int verbCnt = path.countVerbs();
100 if (verbCnt > kMaxKeyFromDataVerbCnt) {
103 const int pointCnt = path.countPoints();
106 static_assert(
sizeof(
SkPoint) == 2 *
sizeof(uint32_t));
107 static_assert(
sizeof(
SkScalar) ==
sizeof(uint32_t));
110 return 1 + (
SkAlign4(verbCnt) >> 2) + 2 * pointCnt + conicWeightCnt;
115 uint32_t*
key = origKey;
117 const int verbCnt = path.countVerbs();
118 const int pointCnt = path.countPoints();
120 SkASSERT(verbCnt <= kMaxKeyFromDataVerbCnt);
124 int verbKeySize =
SkAlign4(verbCnt);
126 uint8_t* pad =
reinterpret_cast<uint8_t*
>(
key)+ verbCnt;
127 memset(pad, 0xDE, verbKeySize - verbCnt);
128 key += verbKeySize >> 2;
131 static_assert(
sizeof(
SkPoint) == 2 *
sizeof(uint32_t));
134 static_assert(
sizeof(
SkScalar) ==
sizeof(uint32_t));
142 switch(this->
type()) {
144 static_assert(0 ==
sizeof(
skvx::float4) %
sizeof(uint32_t));
148 static_assert(0 ==
sizeof(
Rect) %
sizeof(uint32_t));
149 count +=
sizeof(
Rect) /
sizeof(uint32_t);
163 if (dataKeySize >= 0) {
164 count += dataKeySize;
183 *
key++ = this->stateKey(includeInverted);
185 switch(this->
type()) {
193 if (dataKeySize >= 0) {
203 key +=
sizeof(
Rect) /
sizeof(uint32_t);
236uint32_t Shape::stateKey(
bool includeInverted)
const {
238 if (includeInverted) {
241 : (fInverted ? 1 : 0);
247 key |= ((uint32_t) fType) << 2;
static int path_key_from_data_size(const SkPath &path)
static void write_path_key_from_data(const SkPath &path, uint32_t *origKey)
static constexpr T SkAlign4(T x)
static void * sk_careful_memcpy(void *dst, const void *src, size_t len)
static const uint8_t * VerbData(const SkPath &path)
static const SkScalar * ConicWeightData(const SkPath &path)
static const SkPoint * PointData(const SkPath &path)
static int ConicWeightCnt(const SkPath &path)
uint32_t getGenerationID() const
bool conservativelyContainsRect(const SkRect &rect) const
SkPathFillType getFillType() const
const SkRect & getBounds() const
bool isLastContourClosed() const
bool contains(SkScalar x, SkScalar y) const
static bool ContainsPoint(const SkRRect &rr, const SkPoint &p)
size_t writeToMemory(void *buffer) const
bool contains(const SkRect &rect) const
static constexpr size_t kSizeInMemory
const SkRect & getBounds() const
AI bool contains(Rect rect) const
AI Rect makeSorted() const
AI SkRect asSkRect() const
static AI Rect Point(float2 p)
bool convex(bool simpleFill=true) const
void setLine(SkPoint p0, SkPoint p1)
const SkPath & path() const
void setRRect(const SkRRect &rrect)
Shape & operator=(Shape &&)=delete
void writeKey(uint32_t *key, bool includeInverted) const
skvx::float4 line() const
SkPathFillType fillType() const
const SkRRect & rrect() const
const Rect & rect() const
bool conservativeContains(const Rect &rect) const
void setRect(const SkRect &rect)
void setPath(const SkPath &path)