• Home
  • Raw
  • Download

Lines Matching +full:path +full:- +full:key

4  * Use of this source code is governed by a BSD-style license that can be
49 // key. Otherwise, we wipe it out below since the style change invalidates it. in MakeFilled()
63 // Going from a non-filled style to fill may allow additional simplifications (e.g. in MakeFilled()
76 // We don't copy the inherited key since it can contain path effect information that we just in MakeFilled()
82 if (this->isEmpty() && !fStyle.hasNonDashPathEffect()) { in styledBounds()
87 fStyle.adjustBounds(&bounds, this->bounds()); in styledBounds()
91 // If the path is small enough to be keyed from its data this returns key length, otherwise -1.
92 static int path_key_from_data_size(const SkPath& path) { in path_key_from_data_size() argument
93 const int verbCnt = path.countVerbs(); in path_key_from_data_size()
95 return -1; in path_key_from_data_size()
97 const int pointCnt = path.countPoints(); in path_key_from_data_size()
98 const int conicWeightCnt = SkPathPriv::ConicWeightCnt(path); in path_key_from_data_size()
107 // Writes the path data key into the passed pointer.
108 static void write_path_key_from_data(const SkPath& path, uint32_t* origKey) { in write_path_key_from_data() argument
109 uint32_t* key = origKey; in write_path_key_from_data() local
111 const int verbCnt = path.countVerbs(); in write_path_key_from_data()
112 const int pointCnt = path.countPoints(); in write_path_key_from_data()
113 const int conicWeightCnt = SkPathPriv::ConicWeightCnt(path); in write_path_key_from_data()
116 *key++ = verbCnt; in write_path_key_from_data()
117 memcpy(key, SkPathPriv::VerbData(path), verbCnt * sizeof(uint8_t)); in write_path_key_from_data()
120 uint8_t* pad = reinterpret_cast<uint8_t*>(key)+ verbCnt; in write_path_key_from_data()
121 memset(pad, 0xDE, verbKeySize - verbCnt); in write_path_key_from_data()
122 key += verbKeySize >> 2; in write_path_key_from_data()
124 memcpy(key, SkPathPriv::PointData(path), sizeof(SkPoint) * pointCnt); in write_path_key_from_data()
126 key += 2 * pointCnt; in write_path_key_from_data()
127 sk_careful_memcpy(key, SkPathPriv::ConicWeightData(path), sizeof(SkScalar) * conicWeightCnt); in write_path_key_from_data()
129 SkDEBUGCODE(key += conicWeightCnt); in write_path_key_from_data()
130 SkASSERT(key - origKey == path_key_from_data_size(path)); in write_path_key_from_data()
138 int count = 1; // Every key has the state flags from the GrShape in unstyledKeySize()
162 return -1; // volatile, so won't be keyed in unstyledKeySize()
164 int dataKeySize = path_key_from_data_size(fShape.path()); in unstyledKeySize()
172 // else it's empty, which just needs the state flags for its key in unstyledKeySize()
178 void GrStyledShape::writeUnstyledKey(uint32_t* key) const { in writeUnstyledKey()
179 SkASSERT(this->unstyledKeySize()); in writeUnstyledKey()
180 SkDEBUGCODE(uint32_t* origKey = key;) in writeUnstyledKey()
182 memcpy(key, fInheritedKey.get(), sizeof(uint32_t) * fInheritedKey.count()); in writeUnstyledKey()
183 SkDEBUGCODE(key += fInheritedKey.count();) in writeUnstyledKey()
187 // matter that we universally include them in the flag key value. in writeUnstyledKey()
192 // Every key starts with the state from the GrShape (this includes path fill type, in writeUnstyledKey()
194 *key++ = fShape.stateKey(); in writeUnstyledKey()
199 … // Ensure that the path's inversion matches our state so that the path's key suffices. in writeUnstyledKey()
200 SkASSERT(fShape.inverted() == fShape.path().isInverseFillType()); in writeUnstyledKey()
202 int dataKeySize = path_key_from_data_size(fShape.path()); in writeUnstyledKey()
204 write_path_key_from_data(fShape.path(), key); in writeUnstyledKey()
207 *key++ = fGenID; in writeUnstyledKey()
211 memcpy(key, &fShape.point(), sizeof(SkPoint)); in writeUnstyledKey()
212 key += sizeof(SkPoint) / sizeof(uint32_t); in writeUnstyledKey()
215 memcpy(key, &fShape.rect(), sizeof(SkRect)); in writeUnstyledKey()
216 key += sizeof(SkRect) / sizeof(uint32_t); in writeUnstyledKey()
219 fShape.rrect().writeToMemory(key); in writeUnstyledKey()
220 key += SkRRect::kSizeInMemory / sizeof(uint32_t); in writeUnstyledKey()
224 memcpy(key, &fShape.arc(), sizeof(SkRect) + 2 * sizeof(float)); in writeUnstyledKey()
225 key += (sizeof(GrArc) / sizeof(uint32_t) - 1); in writeUnstyledKey()
227 *key++ = fShape.arc().fUseCenter ? 1 : 0; in writeUnstyledKey()
230 memcpy(key, &fShape.line(), sizeof(GrLineSegment)); in writeUnstyledKey()
231 key += sizeof(GrLineSegment) / sizeof(uint32_t); in writeUnstyledKey()
234 // Nothing other than the flag state is needed in the key for an empty shape in writeUnstyledKey()
238 SkASSERT(key - origKey == this->unstyledKeySize()); in writeUnstyledKey()
244 // If the output shape turns out to be simple, then we will just use its geometric key in setInheritedKey()
246 // We want ApplyFullStyle(ApplyPathEffect(shape)) to have the same key as in setInheritedKey()
248 // The full key is structured as (geo,path_effect,stroke). in setInheritedKey()
249 // If we do ApplyPathEffect we get geo,path_effect as the inherited key. If we then in setInheritedKey()
250 // do ApplyFullStyle we'll memcpy geo,path_effect into the new inherited key in setInheritedKey()
251 // and then append the style key (which should now be stroke only) at the end. in setInheritedKey()
257 // The parent's geometry has no key so we will have no key. in setInheritedKey()
271 // The style doesn't allow a key, set the path gen ID to 0 so that we fail when in setInheritedKey()
272 // we try to get a key for the shape. in setInheritedKey()
278 // This will be the geo key. in setInheritedKey()
294 } else if (fShape.isPath() && !fShape.path().isVolatile()) { in originalPathForListeners()
295 return &fShape.path(); in originalPathForListeners()
301 if (const auto* lp = this->originalPathForListeners()) { in addGenIDChangeListener()
347 // Start out as an empty path that is filled in by the applied style in GrStyledShape()
353 srcForPathEffect = &parent.fShape.path(); in GrStyledShape()
358 // Should we consider bounds? Would have to include in key, but it'd be nice to know in GrStyledShape()
359 // if the bounds actually modified anything before including in key. in GrStyledShape()
361 if (!parent.fStyle.applyPathEffectToPath(&fShape.path(), &strokeRec, *srcForPathEffect, in GrStyledShape()
364 *this = tmpParent->applyStyle(apply, scale); in GrStyledShape()
367 // A path effect has access to change the res scale but we aren't expecting it to and it in GrStyledShape()
368 // would mess up our key computation. in GrStyledShape()
371 // The intermediate shape may not be a general path. If we we're just applying in GrStyledShape()
372 // the path effect then attemptToReduceFromPath would catch it. This means that in GrStyledShape()
373 // when we subsequently applied the remaining strokeRec we would have a non-path in GrStyledShape()
374 // parent shape that would be used to determine the the stroked path's key. in GrStyledShape()
376 // the simpler shape so that applying both path effect and the strokerec all at in GrStyledShape()
377 // once produces the same key. in GrStyledShape()
378 tmpParent.init(fShape.path(), GrStyle(strokeRec, nullptr)); in GrStyledShape()
379 tmpParent->setInheritedKey(parent, GrStyle::Apply::kPathEffectOnly, scale); in GrStyledShape()
383 tmpParent->asPath(tmpPath.get()); in GrStyledShape()
386 if (tmpParent->style().applies()) { in GrStyledShape()
387 SkAssertResult(tmpParent.get()->style().applyToPath(&fShape.path(), &fillOrHairline, in GrStyledShape()
389 } else if (tmpParent->style().isSimpleFill()) { in GrStyledShape()
392 SkASSERT(tmpParent.get()->style().isSimpleHairline()); in GrStyledShape()
403 srcForParentStyle = &parent.fShape.path(); in GrStyledShape()
411 SkAssertResult(parent.fStyle.applyToPath(&fShape.path(), &fillOrHairline, in GrStyledShape()
418 } else if (parent.fShape.isPath() && !parent.fShape.path().isVolatile()) { in GrStyledShape()
419 fInheritedPathForListeners.set(parent.fShape.path()); in GrStyledShape()
421 this->simplify(); in GrStyledShape()
422 this->setInheritedKey(*parentForKey, apply, scale); in GrStyledShape()
431 // Validity check here, if we don't have a path effect on the style, we should have passed in asRRect()
442 // Don't bother mapping these if we don't have a path effect, however. in asRRect()
465 // Toggle direction and map index by 3 - start in asRRect()
471 rectStart = 3 - rectStart; in asRRect()
528 // them to a path and then reextracting the nested rects in asNestedRects()
529 if (fShape.path().isInverseFillType()) { in asNestedRects()
534 if (!SkPathPriv::IsNestedFillRects(fShape.path(), rects, dirs)) { in asNestedRects()
538 if (SkPathFillType::kWinding == fShape.path().getFillType() && dirs[0] == dirs[1]) { in asNestedRects()
550 SkScalar margin = SkScalarAbs(outer[0] - inner[0]); in asNestedRects()
554 SkScalar temp = SkScalarAbs(outer[i] - inner[i]); in asNestedRects()
570 : fShape(shape), fInverted(!style.isDashed() && fShape->inverted()) {} in AutoRestoreInverseness()
574 fShape->setInverted(fInverted); in ~AutoRestoreInverseness()
575 SkASSERT(!fShape->isPath() || fInverted == fShape->path().isInverseFillType()); in ~AutoRestoreInverseness()
595 } // else if there's a path effect, every destructive simplification is disabledd in simplify()
604 // The shape remains a path, so configure the gen ID and canonicalize fill type if possible in simplify()
605 if (fInheritedKey.count() || fShape.path().isVolatile()) { in simplify()
608 fGenID = fShape.path().getGenerationID(); in simplify()
613 fShape.path().isConvex())) { in simplify()
615 // distinction between even/odd and non-zero winding count for convex paths. in simplify()
617 fShape.path().setFillType(GrShape::kDefaultFillType); in simplify()
621 // Whenever we simplify to a non-path, break the chain so we no longer refer to the in simplify()
622 // original path. This prevents attaching genID listeners to temporary paths created when in simplify()
626 this->simplifyStroke(); in simplify()
640 // Bevel-stroked rect needs path rendering in simplifyStroke()
676 // An off interval has non-zero length so this won't convert to a simple line in simplifyStroke()
694 // At this point, we're a line or point with no path effects. Any fill portion of the style in simplifyStroke()
695 // is empty, so a fill-only style can be empty, and a stroke+fill becomes a stroke. in simplifyStroke()
714 // turn. With round joins, this would make a semi-circle at each end, which is visually in simplifyStroke()
721 // - to match the SVG spec, the 0-length sides of an empty rectangle are skipped, so in simplifyStroke()
753 // Stroked lines reduce to rectangles or round rects when they are axis-aligned. If we in simplifyStroke()