diff options
author | 2014-07-11 10:42:12 -0700 | |
---|---|---|
committer | 2014-07-11 10:42:12 -0700 | |
commit | c870d494dd0dc88f3f4155a0d6257a1be8280880 (patch) | |
tree | 3db077efd222fbf616eda5220ab5f26078a5d85f /include/core | |
parent | b02ab4b47be0f4d1bace70802a1ca430c878b48b (diff) |
Use SkShader's localMat for SkLocalMatrixShader.
Instead of setting SkShader::fLocalMatrix to Identity and storing
a separate SkMatrix inside SkLocalMatrixShader, reuse
SkShader::fLocalMatrix.
R=reed@google.com
Author: scroggo@google.com
Review URL: https://codereview.chromium.org/386693003
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkPicture.h | 3 | ||||
-rw-r--r-- | include/core/SkReadBuffer.h | 1 | ||||
-rw-r--r-- | include/core/SkShader.h | 11 |
3 files changed, 13 insertions, 2 deletions
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index ca26eb4496..03d983fe58 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -231,13 +231,14 @@ private: // V27: Remove SkUnitMapper from gradients (and skia). // V28: No longer call bitmap::flatten inside SkWriteBuffer::writeBitmap. // V29: Removed SaveFlags parameter from save(). + // V30: Remove redundant SkMatrix from SkLocalMatrixShader. // Note: If the picture version needs to be increased then please follow the // steps to generate new SKPs in (only accessible to Googlers): http://goo.gl/qATVcw // Only SKPs within the min/current picture version range (inclusive) can be read. static const uint32_t MIN_PICTURE_VERSION = 19; - static const uint32_t CURRENT_PICTURE_VERSION = 29; + static const uint32_t CURRENT_PICTURE_VERSION = 30; mutable uint32_t fUniqueID; diff --git a/include/core/SkReadBuffer.h b/include/core/SkReadBuffer.h index 5db86345ad..faf7eb81a5 100644 --- a/include/core/SkReadBuffer.h +++ b/include/core/SkReadBuffer.h @@ -45,6 +45,7 @@ public: kColorShaderNoBool_Version = 26, kNoUnitMappers_Version = 27, kNoMoreBitmapFlatten_Version = 28, + kSimplifyLocalMatrix_Version = 30, }; /** diff --git a/include/core/SkShader.h b/include/core/SkShader.h index 8871f1b021..33a7a15b0f 100644 --- a/include/core/SkShader.h +++ b/include/core/SkShader.h @@ -41,11 +41,17 @@ public: /** * Returns the local matrix. + * + * FIXME: This can be incorrect for a Shader with its own local matrix + * that is also wrapped via CreateLocalMatrixShader. */ const SkMatrix& getLocalMatrix() const { return fLocalMatrix; } /** * Returns true if the local matrix is not an identity matrix. + * + * FIXME: This can be incorrect for a Shader with its own local matrix + * that is also wrapped via CreateLocalMatrixShader. */ bool hasLocalMatrix() const { return !fLocalMatrix.isIdentity(); } @@ -474,7 +480,10 @@ protected: private: SkMatrix fLocalMatrix; - + + // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer constructor. + friend class SkLocalMatrixShader; + typedef SkFlattenable INHERITED; }; |