From: fmalita Date: Wed, 10 Dec 2014 21:01:43 +0000 (-0800) Subject: Don't store an SkMatrix in BitmapShaderKey. X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~4496 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=04b49c31789201fbef969f5598a286187920dd56;p=platform%2Fupstream%2FlibSkiaSharp.git Don't store an SkMatrix in BitmapShaderKey. SkMatrix makes for a poor key component due to mutable/cache fields. Use its canonical scalars instead. R=reed@google.com,mtklein@google.com Review URL: https://codereview.chromium.org/792123002 --- diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp index fb05597..73807b3 100644 --- a/src/core/SkPictureShader.cpp +++ b/src/core/SkPictureShader.cpp @@ -34,14 +34,17 @@ public: , fTile(tile) , fTmx(tmx) , fTmy(tmy) - , fScale(scale) - , fLocalMatrix(localMatrix) { + , fScale(scale) { + + for (int i = 0; i < 9; ++i) { + fLocalMatrixStorage[i] = localMatrix[i]; + } static const size_t keySize = sizeof(fPictureID) + sizeof(fTile) + sizeof(fTmx) + sizeof(fTmy) + sizeof(fScale) + - sizeof(fLocalMatrix); + sizeof(fLocalMatrixStorage); // This better be packed. SkASSERT(sizeof(uint32_t) * (&fEndOfStruct - &fPictureID) == keySize); this->init(&gBitmapSkaderKeyNamespaceLabel, keySize); @@ -52,7 +55,7 @@ private: SkRect fTile; SkShader::TileMode fTmx, fTmy; SkSize fScale; - SkMatrix fLocalMatrix; + SkScalar fLocalMatrixStorage[9]; SkDEBUGCODE(uint32_t fEndOfStruct;) };