Index: src/core/SkMatrix.cpp |
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp |
index 5bcb35b298874088004f5c39fba7133e85a0c323..e8d0b73468fff2a0ae59e35e79da2f1bb4fe01c0 100644 |
--- a/src/core/SkMatrix.cpp |
+++ b/src/core/SkMatrix.cpp |
@@ -1921,20 +1921,28 @@ const SkMatrix& SkMatrix::InvalidMatrix() { |
/////////////////////////////////////////////////////////////////////////////// |
+uint32_t SkMatrix::sizeInMemory() const { |
+ return SizeToRead(); // This is a constant for SkMatrix |
+} |
+ |
+uint32_t SkMatrix::SizeToRead() { |
+ return 9 * sizeof(SkScalar); |
+} |
+ |
uint32_t SkMatrix::writeToMemory(void* buffer) const { |
// TODO write less for simple matrices |
if (buffer) { |
- memcpy(buffer, fMat, 9 * sizeof(SkScalar)); |
+ memcpy(buffer, fMat, sizeInMemory()); |
} |
- return 9 * sizeof(SkScalar); |
+ return sizeInMemory(); |
} |
uint32_t SkMatrix::readFromMemory(const void* buffer) { |
if (buffer) { |
- memcpy(fMat, buffer, 9 * sizeof(SkScalar)); |
+ memcpy(fMat, buffer, SizeToRead()); |
this->setTypeMask(kUnknown_Mask); |
} |
- return 9 * sizeof(SkScalar); |
+ return sizeInMemory(); |
} |
#ifdef SK_DEVELOPER |