aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPathRef.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-03 17:15:36 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-03 17:15:36 +0000
commitb06e88dc6505412cc2b1a5f0bfb0f669465e1f8e (patch)
tree424fa7904f73fc410b616290fd9b45ad0d544653 /src/core/SkPathRef.cpp
parent466310dbd3073add2ec934e336c30deaaf702eae (diff)
Fix for SkPathRef::CreateTransformedCopy bug
Diffstat (limited to 'src/core/SkPathRef.cpp')
-rw-r--r--src/core/SkPathRef.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index 3ad5ae7e02..1678fdc235 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -63,14 +63,20 @@ void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst,
return;
}
- bool dstUnique = (*dst)->unique();
- if (!dstUnique) {
+ if (!(*dst)->unique()) {
dst->reset(SkNEW(SkPathRef));
+ }
+
+ if (*dst != &src) {
(*dst)->resetToSize(src.fVerbCnt, src.fPointCnt, src.fConicWeights.count());
memcpy((*dst)->verbsMemWritable(), src.verbsMemBegin(), src.fVerbCnt * sizeof(uint8_t));
(*dst)->fConicWeights = src.fConicWeights;
}
+ SkASSERT((*dst)->countPoints() == src.countPoints());
+ SkASSERT((*dst)->countVerbs() == src.countVerbs());
+ SkASSERT((*dst)->fConicWeights.count() == src.fConicWeights.count());
+
// Need to check this here in case (&src == dst)
bool canXformBounds = !src.fBoundsIsDirty && matrix.rectStaysRect() && src.countPoints() > 1;