aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-02-17 12:16:27 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-17 12:16:27 -0800
commit6900641e02c3b6c7ee15d0aa5bd4af0d42db480f (patch)
treef2c3dbad70bdb4d6cdc4e793b06293c713aeeb67 /src
parent134ad3e5b0979c2fd60dc01717022cac57fd76ec (diff)
add last move to serialized path
A deserialized path keeps the last move location so that a subsequent append to the path does not add an unwanted close verb. R=reed@oogle.com BUG=skia:4847 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1702393002 Review URL: https://codereview.chromium.org/1702393002
Diffstat (limited to 'src')
-rw-r--r--src/core/SkPath.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index dcc3e0202d..719c0330dc 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1965,7 +1965,7 @@ size_t SkPath::writeToMemory(void* storage) const {
SkDEBUGCODE(this->validate();)
if (nullptr == storage) {
- const int byteCount = sizeof(int32_t) + fPathRef->writeSize();
+ const int byteCount = sizeof(int32_t) * 2 + fPathRef->writeSize();
return SkAlign4(byteCount);
}
@@ -1978,6 +1978,7 @@ size_t SkPath::writeToMemory(void* storage) const {
kCurrent_Version;
buffer.write32(packed);
+ buffer.write32(fLastMoveToIndex);
fPathRef->writeToBuffer(&buffer);
@@ -1994,6 +1995,9 @@ size_t SkPath::readFromMemory(const void* storage, size_t length) {
}
unsigned version = packed & 0xFF;
+ if (version >= kPathPrivLastMoveToIndex_Version && !buffer.readS32(&fLastMoveToIndex)) {
+ return 0;
+ }
fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF;
fFillType = (packed >> kFillType_SerializationShift) & 0xFF;