diff options
author | Cary Clark <caryclark@skia.org> | 2017-10-20 12:14:33 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-20 16:49:57 +0000 |
commit | 6d6d603c812a6c9bb3e70157be909d355233ba6d (patch) | |
tree | 71f1700b4f93dc48d15736bc0f4eb19c458b5a19 /include | |
parent | 5a83f590911f30b125bc6edce01a26ac971d6e1d (diff) |
make matrix serialization private
Moves readFromMemory, writeToMemory to private section.
No sign that these are called from google3, android,
chromium, but function names are common enough that
it's hard to know for sure.
These are used inside templates internally and for
testing, so it is not quite as simple as adding alternate
entry points in SkMatrixPriv.
R=reed@google.com
Bug: skia:6898
Change-Id: I1fac142f4bf0f38608ea93438c46f39147606c4d
Reviewed-on: https://skia-review.googlesource.com/62361
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkMatrix.h | 30 | ||||
-rw-r--r-- | include/core/SkWriter32.h | 6 |
2 files changed, 15 insertions, 21 deletions
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h index e22099ca98..49be97aa29 100644 --- a/include/core/SkMatrix.h +++ b/include/core/SkMatrix.h @@ -601,22 +601,6 @@ public: return !(a == b); } - enum { - // writeTo/readFromMemory will never return a value larger than this - kMaxFlattenSize = 9 * sizeof(SkScalar) + sizeof(uint32_t), - }; - // return the number of bytes written, whether or not buffer is null - size_t writeToMemory(void* buffer) const; - /** - * Reads data from the buffer parameter - * - * @param buffer Memory to read from - * @param length Amount of memory available in the buffer - * @return number of bytes read (must be a multiple of 4) or - * 0 if there was not enough memory available - */ - size_t readFromMemory(const void* buffer, size_t length); - void dump() const; void toString(SkString* str) const; @@ -850,8 +834,22 @@ private: static const MapPtsProc gMapPtsProcs[]; + // return the number of bytes written, whether or not buffer is null + size_t writeToMemory(void* buffer) const; + /** + * Reads data from the buffer parameter + * + * @param buffer Memory to read from + * @param length Amount of memory available in the buffer + * @return number of bytes read (must be a multiple of 4) or + * 0 if there was not enough memory available + */ + size_t readFromMemory(const void* buffer, size_t length); + friend class SkPerspIter; friend class SkMatrixPriv; + friend class SkReader32; + friend class SerializationTest; }; SK_END_REQUIRE_DENSE diff --git a/include/core/SkWriter32.h b/include/core/SkWriter32.h index beaaee1c7c..e81178d47e 100644 --- a/include/core/SkWriter32.h +++ b/include/core/SkWriter32.h @@ -141,11 +141,7 @@ public: path.writeToMemory(this->reserve(size)); } - void writeMatrix(const SkMatrix& matrix) { - size_t size = matrix.writeToMemory(nullptr); - SkASSERT(SkAlign4(size) == size); - matrix.writeToMemory(this->reserve(size)); - } + void writeMatrix(const SkMatrix& matrix); void writeRegion(const SkRegion& rgn) { size_t size = rgn.writeToMemory(nullptr); |