summaryrefslogtreecommitdiffstats
path: root/gfx/skia
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-11-02 11:56:17 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-11-02 11:56:17 +0100
commit030053f1a4069d3d69a5430ccf675338f89be5a7 (patch)
tree4c158df752a591617c56c63da70d8fbf40728e52 /gfx/skia
parentf42d6c39fea309aefe8a1646980b880516fe2562 (diff)
downloadUXP-030053f1a4069d3d69a5430ccf675338f89be5a7.tar
UXP-030053f1a4069d3d69a5430ccf675338f89be5a7.tar.gz
UXP-030053f1a4069d3d69a5430ccf675338f89be5a7.tar.lz
UXP-030053f1a4069d3d69a5430ccf675338f89be5a7.tar.xz
UXP-030053f1a4069d3d69a5430ccf675338f89be5a7.zip
Backport some upstream Skia patches.
Backport of: https://skia.googlesource.com/skia/+/c3d8a48f1b27370049aa512019cd726c59354743 https://skia.googlesource.com/skia/+/8051d38358293df1e5b8a1a513f8114147ec9fa3
Diffstat (limited to 'gfx/skia')
-rw-r--r--gfx/skia/skia/src/core/SkPath.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/gfx/skia/skia/src/core/SkPath.cpp b/gfx/skia/skia/src/core/SkPath.cpp
index a2ef54620..8f93c9c18 100644
--- a/gfx/skia/skia/src/core/SkPath.cpp
+++ b/gfx/skia/skia/src/core/SkPath.cpp
@@ -14,6 +14,7 @@
#include "SkPathPriv.h"
#include "SkPathRef.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);
}
-void SkPath::addPath(const SkPath& path, const SkMatrix& matrix, AddPathMode mode) {
- SkPathRef::Editor(&fPathRef, path.countVerbs(), path.countPoints());
+void SkPath::addPath(const SkPath& srcPath, const SkMatrix& matrix, AddPathMode mode) {
+ // Detect if we're trying to add ourself
+ const SkPath* src = &srcPath;
+ SkTLazy<SkPath> tmp;
+ if (this == src) {
+ src = tmp.set(srcPath);
+ }
+
+ SkPathRef::Editor(&fPathRef, src->countVerbs(), src->countPoints());
- RawIter iter(path);
+ RawIter iter(*src);
SkPoint pts[4];
Verb verb;
@@ -1602,14 +1610,21 @@ void SkPath::reversePathTo(const SkPath& path) {
}
}
-void SkPath::reverseAddPath(const SkPath& src) {
- SkPathRef::Editor ed(&fPathRef, src.fPathRef->countPoints(), src.fPathRef->countVerbs());
+void SkPath::reverseAddPath(const SkPath& srcPath) {
+ // Detect if we're trying to add ourself
+ const SkPath* src = &srcPath;
+ SkTLazy<SkPath> tmp;
+ if (this == src) {
+ src = tmp.set(srcPath);
+ }
+
+ SkPathRef::Editor ed(&fPathRef, src->fPathRef->countPoints(), src->fPathRef->countVerbs());
- const SkPoint* pts = src.fPathRef->pointsEnd();
+ const SkPoint* pts = src->fPathRef->pointsEnd();
// we will iterator through src's verbs backwards
- 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 SkScalar* conicWeights = src.fPathRef->conicWeightsEnd();
+ 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 SkScalar* conicWeights = src->fPathRef->conicWeightsEnd();
bool needMove = true;
bool needClose = false;