aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkPath.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-09-21 12:29:24 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-21 18:16:13 +0000
commit1e3b79e0c6480ea7e372ec4e5a2c5e11a03a845d (patch)
tree8d6461a4df840960c50bff6f02fb81e6430cd4a3 /include/core/SkPath.h
parent2fbf1bc8c96f749a4c098bcfc827053445c2e12d (diff)
Serialize rrect/oval paths as rrects rather than points and verbs.
This is a step towards not trusting deserialized isoval/isrrect for general paths without losing the performance advantages of knowing that a path is a rrect/oval. Change-Id: I1a8c0608c0f29f4bf7a118dfa1d475e2ab5802ea Reviewed-on: https://skia-review.googlesource.com/49761 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include/core/SkPath.h')
-rw-r--r--include/core/SkPath.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index 7f52f07740..0eb626bd42 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -1682,20 +1682,25 @@ enum Direction {
private:
enum SerializationOffsets {
- // 1 free bit at 29
- kUnused1_SerializationShift = 28, // 1 free bit
- kDirection_SerializationShift = 26, // requires 2 bits
+ kType_SerializationShift = 28, // requires 4 bits
+ kDirection_SerializationShift = 26, // requires 2 bits
kIsVolatile_SerializationShift = 25, // requires 1 bit
// 1 free bit at 24
- kConvexity_SerializationShift = 16, // requires 8 bits
- kFillType_SerializationShift = 8, // requires 8 bits
+ kConvexity_SerializationShift = 16, // requires 8 bits
+ kFillType_SerializationShift = 8, // requires 8 bits
// low-8-bits are version
};
enum SerializationVersions {
kPathPrivFirstDirection_Version = 1,
kPathPrivLastMoveToIndex_Version = 2,
- kCurrent_Version = 2
+ kPathPrivTypeEnumVersion = 3,
+ kCurrent_Version = 3
+ };
+
+ enum SerializationType {
+ kGeneral = 0,
+ kRRect = 1
};
sk_sp<SkPathRef> fPathRef;
@@ -1717,6 +1722,9 @@ private:
*/
void copyFields(const SkPath& that);
+ size_t writeToMemoryAsRRect(int32_t packedHeader, void* buffer) const;
+ size_t readFromMemoryAsRRect(const void* buffer) const;
+
friend class Iter;
friend class SkPathPriv;
friend class SkPathStroker;