29 fSimplified = that.fSimplified;
31 fInheritedKey.
reset(that.fInheritedKey.
count());
33 sizeof(uint32_t) * fInheritedKey.
count());
34 if (that.fInheritedPathForListeners.
isValid()) {
35 fInheritedPathForListeners.
set(*that.fInheritedPathForListeners);
37 fInheritedPathForListeners.
reset();
45 return originalIsInverted;
47 return !originalIsInverted;
65 if (original.fInheritedPathForListeners.
isValid()) {
66 result.fInheritedPathForListeners.set(*original.fInheritedPathForListeners);
69 result.fShape = original.fShape;
70 result.fGenID = original.fGenID;
71 result.fShape.setInverted(newIsInverted);
104 const int verbCnt =
path.countVerbs();
108 const int pointCnt =
path.countPoints();
111 static_assert(
sizeof(
SkPoint) == 2 *
sizeof(uint32_t));
112 static_assert(
sizeof(
SkScalar) ==
sizeof(uint32_t));
115 return 1 + (
SkAlign4(verbCnt) >> 2) + 2 * pointCnt + conicWeightCnt;
120 uint32_t*
key = origKey;
122 const int verbCnt =
path.countVerbs();
123 const int pointCnt =
path.countPoints();
129 int verbKeySize =
SkAlign4(verbCnt);
131 uint8_t* pad =
reinterpret_cast<uint8_t*
>(
key)+ verbCnt;
132 memset(pad, 0xDE, verbKeySize - verbCnt);
133 key += verbKeySize >> 2;
136 static_assert(
sizeof(
SkPoint) == 2 *
sizeof(uint32_t));
139 static_assert(
sizeof(
SkScalar) ==
sizeof(uint32_t));
145 if (fInheritedKey.
count()) {
146 return fInheritedKey.
count();
150 switch(fShape.
type()) {
152 static_assert(0 ==
sizeof(
SkPoint) %
sizeof(uint32_t));
156 static_assert(0 ==
sizeof(
SkRect) %
sizeof(uint32_t));
164 static_assert(0 ==
sizeof(
SkArc) %
sizeof(uint32_t));
168 static_assert(0 ==
sizeof(
GrLineSegment) %
sizeof(uint32_t));
176 if (dataKeySize >= 0) {
177 count += dataKeySize;
192 if (fInheritedKey.
count()) {
193 memcpy(
key, fInheritedKey.
get(),
sizeof(uint32_t) * fInheritedKey.
count());
207 switch(fShape.
type()) {
214 if (dataKeySize >= 0) {
227 key +=
sizeof(
SkRect) /
sizeof(uint32_t);
235 memcpy(
key, &fShape.
arc(),
sizeof(
SkRect) + 2 *
sizeof(
float));
236 key += (
sizeof(
SkArc) /
sizeof(uint32_t) - 1);
263 int parentCnt = parent.fInheritedKey.
count();
264 bool useParentGeoKey = !parentCnt;
265 if (useParentGeoKey) {
273 uint32_t styleKeyFlags = 0;
277 if (parent.
asLine(
nullptr,
nullptr)) {
287 fInheritedKey.
reset(parentCnt + styleCnt);
288 if (useParentGeoKey) {
293 memcpy(fInheritedKey.
get(), parent.fInheritedKey.
get(),
294 parentCnt *
sizeof(uint32_t));
302const SkPath* GrStyledShape::originalPathForListeners()
const {
303 if (fInheritedPathForListeners.
isValid()) {
304 return fInheritedPathForListeners.
get();
306 return &fShape.
path();
312 if (
const auto* lp = this->originalPathForListeners()) {
333 , fGenID(that.fGenID)
334 , fSimplified(that.fSimplified) {
335 fInheritedKey.
reset(that.fInheritedKey.
count());
337 sizeof(uint32_t) * fInheritedKey.
count());
338 if (that.fInheritedPathForListeners.
isValid()) {
339 fInheritedPathForListeners.
set(*that.fInheritedPathForListeners);
363 const SkPath* srcForPathEffect;
364 if (parent.fShape.
isPath()) {
365 srcForPathEffect = &parent.fShape.
path();
367 srcForPathEffect = tmpPath.
init();
375 tmpParent.
init(*srcForPathEffect,
GrStyle(strokeRec,
nullptr));
395 tmpParent->asPath(tmpPath.
get());
398 if (tmpParent->style().applies()) {
401 }
else if (tmpParent->style().isSimpleFill()) {
404 SkASSERT(tmpParent.
get()->style().isSimpleHairline());
408 parentForKey = tmpParent.
get();
410 fStyle =
GrStyle(strokeRec,
nullptr);
413 const SkPath* srcForParentStyle;
414 if (parent.fShape.
isPath()) {
415 srcForParentStyle = &parent.fShape.
path();
417 srcForParentStyle = tmpPath.
init();
424 *srcForParentStyle,
scale));
428 if (parent.fInheritedPathForListeners.
isValid()) {
429 fInheritedPathForListeners.
set(*parent.fInheritedPathForListeners);
431 fInheritedPathForListeners.
set(parent.fShape.
path());
434 this->setInheritedKey(*parentForKey,
apply,
scale);
499 for (
int i = 1;
i < 4; ++
i) {
509 return allEq || allGoE1;
516 : fShape(shape), fInverted(!style.isDashed() && fShape->inverted()) {}
532 unsigned simplifyFlags = 0;
546 fClosed = fShape.
simplify(simplifyFlags);
547 fSimplified = oldType != fShape.
type();
566 fInheritedKey.
reset(0);
570 fInheritedPathForListeners.
reset();
572 this->simplifyStroke();
576void GrStyledShape::simplifyStroke() {
610 bool styleSimplified =
false;
614 bool dropDash =
false;
637 styleSimplified =
true;
650 fStyle =
GrStyle(rec,
nullptr);
651 styleSimplified =
true;
677 fStyle =
GrStyle(rec,
nullptr);
678 styleSimplified =
true;
718 fSimplified |= styleSimplified;
722 if (
rect.isEmpty()) {
SkStrokeRec::Style fStyle
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static bool inversion(Vertex *prev, Vertex *next, Edge *origEdge, const Comparator &c)
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)
static constexpr T SkAlign4(T x)
static void * sk_careful_memcpy(void *dst, const void *src, size_t len)
static bool apply(Pass *pass, SkRecord *record)
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
static constexpr bool SkToBool(const T &x)
AutoRestoreInverseness(GrShape *shape, const GrStyle &style)
~AutoRestoreInverseness()
uint32_t stateKey() const
void setRRect(const SkRRect &rrect)
void setPath(const SkPath &path)
SkPathDirection dir() const
static constexpr SkPathDirection kDefaultDir
static constexpr SkPathFillType kDefaultFillType
void setInverted(bool inverted)
unsigned startIndex() const
static constexpr unsigned kDefaultStart
void setRect(const SkRect &rect)
bool simplify(unsigned flags=kAll_Flags)
void adjustBounds(SkRect *dst, const SkRect &src) const
const SkScalar * dashIntervals() const
@ kPathEffectAndStrokeRec
bool applyToPath(SkPath *dst, SkStrokeRec::InitStyle *fillOrHairline, const SkPath &src, SkScalar scale) const
SkPathEffect * pathEffect() const
bool hasPathEffect() const
static void WriteKey(uint32_t *, const GrStyle &, Apply, SkScalar scale, uint32_t flags=0)
static const GrStyle & SimpleFill()
bool hasNonDashPathEffect() const
int dashIntervalCnt() const
bool applyPathEffectToPath(SkPath *dst, SkStrokeRec *remainingStoke, const SkPath &src, SkScalar scale) const
bool isSimpleFill() const
void resetToInitStyle(SkStrokeRec::InitStyle fillOrHairline)
static int KeySize(const GrStyle &, Apply, uint32_t flags=0)
const SkStrokeRec & strokeRec() const
bool knownToBeClosed() const
void asPath(SkPath *out) const
void writeUnstyledKey(uint32_t *key) const
int unstyledKeySize() const
static GrStyledShape MakeArc(const SkArc &arc, const GrStyle &style, DoSimplify=DoSimplify::kYes)
bool asLine(SkPoint pts[2], bool *inverted) const
bool asRRect(SkRRect *rrect, bool *inverted) const
const GrStyle & style() const
SkRect styledBounds() const
bool asNestedRects(SkRect rects[2]) const
void addGenIDChangeListener(sk_sp< SkIDChangeListener >) const
static constexpr int kMaxKeyFromDataVerbCnt
static GrStyledShape MakeFilled(const GrStyledShape &original, FillInversion=FillInversion::kPreserve)
GrStyledShape & operator=(const GrStyledShape &that)
@ kButt_Cap
no stroke extension
@ kDefault_Join
equivalent to kMiter_Join
@ kMiter_Join
extends to miter limit
@ kBevel_Join
connects outside edges
static bool IsNestedFillRects(const SkPath &, SkRect rect[2], SkPathDirection dirs[2]=nullptr)
static const uint8_t * VerbData(const SkPath &path)
static void AddGenIDChangeListener(const SkPath &path, sk_sp< SkIDChangeListener > listener)
static const SkScalar * ConicWeightData(const SkPath &path)
static const SkPoint * PointData(const SkPath &path)
static int ConicWeightCnt(const SkPath &path)
bool isInverseFillType() const
uint32_t getGenerationID() const
SkPathFillType getFillType() const
void setFillType(SkPathFillType ft)
static SkRRect MakeOval(const SkRect &oval)
static SkRRect MakeRect(const SkRect &r)
size_t writeToMemory(void *buffer) const
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
static constexpr size_t kSizeInMemory
void setStrokeStyle(SkScalar width, bool strokeAndFill=false)
bool isHairlineStyle() const
SkScalar getWidth() const
void setStrokeParams(SkPaint::Cap cap, SkPaint::Join join, SkScalar miterLimit)
SkPaint::Join getJoin() const
SkPaint::Cap getCap() const
SkScalar getResScale() const
SkScalar getMiter() const
T * init(Args &&... args)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
sk_sp< SkBlender > blender SkRect rect
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
static SkArc Make(const SkRect &oval, SkScalar startAngleDegrees, SkScalar sweepAngleDegrees, Type type)
SkRect makeSorted() const
static constexpr SkRect MakeEmpty()
void outset(float dx, float dy)
const float * asScalars() const