diff options
author | Matt Sarett <msarett@google.com> | 2017-04-21 15:06:51 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-21 19:34:43 +0000 |
commit | e71db447d4ac5fe23afb092b4764e4311eabaff7 (patch) | |
tree | a5a2527af1ff59e2457cf10bb5762888fbcce5c2 /src/core | |
parent | 1be0db86aae4f69df4b71cc387eeda70d72afd56 (diff) |
Use dstColorSpace in SkPictureShader cache key
Starting with the bug fix + test.
Broken off of:
https://skia-review.googlesource.com/c/13976
Bug: skia:
Change-Id: If6c28e2dfb0c5340c48e943d0313a9ea9515a6c3
Reviewed-on: https://skia-review.googlesource.com/14061
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkPictureShader.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp index 50c33a82a0..3e36ffb306 100644 --- a/src/core/SkPictureShader.cpp +++ b/src/core/SkPictureShader.cpp @@ -30,13 +30,15 @@ static unsigned gBitmapSkaderKeyNamespaceLabel; struct BitmapShaderKey : public SkResourceCache::Key { public: - BitmapShaderKey(uint32_t pictureID, + BitmapShaderKey(sk_sp<SkColorSpace> colorSpace, + uint32_t pictureID, const SkRect& tile, SkShader::TileMode tmx, SkShader::TileMode tmy, const SkSize& scale, const SkMatrix& localMatrix) - : fPictureID(pictureID) + : fColorSpace(std::move(colorSpace)) + , fPictureID(pictureID) , fTile(tile) , fTmx(tmx) , fTmy(tmy) @@ -46,22 +48,24 @@ public: fLocalMatrixStorage[i] = localMatrix[i]; } - static const size_t keySize = sizeof(fPictureID) + + static const size_t keySize = sizeof(fColorSpace) + + sizeof(fPictureID) + sizeof(fTile) + sizeof(fTmx) + sizeof(fTmy) + sizeof(fScale) + sizeof(fLocalMatrixStorage); // This better be packed. - SkASSERT(sizeof(uint32_t) * (&fEndOfStruct - &fPictureID) == keySize); + SkASSERT(sizeof(uint32_t) * (&fEndOfStruct - (uint32_t*)&fColorSpace) == keySize); this->init(&gBitmapSkaderKeyNamespaceLabel, 0, keySize); } private: - uint32_t fPictureID; - SkRect fTile; - SkShader::TileMode fTmx, fTmy; - SkSize fScale; - SkScalar fLocalMatrixStorage[9]; + sk_sp<SkColorSpace> fColorSpace; + uint32_t fPictureID; + SkRect fTile; + SkShader::TileMode fTmx, fTmy; + SkSize fScale; + SkScalar fLocalMatrixStorage[9]; SkDEBUGCODE(uint32_t fEndOfStruct;) }; @@ -216,7 +220,8 @@ sk_sp<SkShader> SkPictureShader::refBitmapShader(const SkMatrix& viewMatrix, con SkIntToScalar(tileSize.height()) / fTile.height()); sk_sp<SkShader> tileShader; - BitmapShaderKey key(fPicture->uniqueID(), + BitmapShaderKey key(sk_ref_sp(dstColorSpace), + fPicture->uniqueID(), fTile, fTmx, fTmy, |