wolfbeast 2018-11-02 11:56:17 +01:00 • committed by Roy Tam
commit b52b4b9f63

View file

@ -14,6 +14,7 @@
#include "SkPathPriv.h" #include "SkPathPriv.h"
#include "SkPathRef.h" #include "SkPathRef.h"
#include "SkRRect.h" #include "SkRRect.h"
#include "SkTLazy.h"
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
@ -1491,10 +1492,17 @@ void SkPath::addPath(const SkPath& path, SkScalar dx, SkScalar dy, AddPathMode m
this->addPath(path, matrix, mode); this->addPath(path, matrix, mode);
} }
void SkPath::addPath(const SkPath& path, const SkMatrix& matrix, AddPathMode mode) { void SkPath::addPath(const SkPath& srcPath, const SkMatrix& matrix, AddPathMode mode) {
SkPathRef::Editor(&fPathRef, path.countVerbs(), path.countPoints()); // Detect if we're trying to add ourself
const SkPath* src = &srcPath;
SkTLazy<SkPath> tmp;
if (this == src) {
src = tmp.set(srcPath);
}
RawIter iter(path); SkPathRef::Editor(&fPathRef, src->countVerbs(), src->countPoints());
RawIter iter(*src);
SkPoint pts[4]; SkPoint pts[4];
Verb verb; Verb verb;
@ -1602,14 +1610,21 @@ void SkPath::reversePathTo(const SkPath& path) {
} }
} }
void SkPath::reverseAddPath(const SkPath& src) { void SkPath::reverseAddPath(const SkPath& srcPath) {
SkPathRef::Editor ed(&fPathRef, src.fPathRef->countPoints(), src.fPathRef->countVerbs()); // Detect if we're trying to add ourself
const SkPath* src = &srcPath;
SkTLazy<SkPath> tmp;
if (this == src) {
src = tmp.set(srcPath);
}
const SkPoint* pts = src.fPathRef->pointsEnd(); SkPathRef::Editor ed(&fPathRef, src->fPathRef->countPoints(), src->fPathRef->countVerbs());
const SkPoint* pts = src->fPathRef->pointsEnd();
// we will iterator through src's verbs backwards // we will iterator through src's verbs backwards
const uint8_t* verbs = src.fPathRef->verbsMemBegin(); // points at the last verb const uint8_t* verbs = src->fPathRef->verbsMemBegin(); // points at the last verb
const uint8_t* verbsEnd = src.fPathRef->verbs(); // points just past the first verb const uint8_t* verbsEnd = src->fPathRef->verbs(); // points just past the first verb
const SkScalar* conicWeights = src.fPathRef->conicWeightsEnd(); const SkScalar* conicWeights = src->fPathRef->conicWeightsEnd();
bool needMove = true; bool needMove = true;
bool needClose = false; bool needClose = false;