Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: src/core/SkPictureShader.cpp

Issue 792123002: Don't store an SkMatrix in BitmapShaderKey. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use kMaxFlattenSize Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureShader.cpp
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index 198a2a9e497602b24e0ed7b5ed4a9f66c9899a19..947a5383210e8d94355fdbe5d4437e53e374213f 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -14,6 +14,7 @@
#include "SkPicture.h"
#include "SkReadBuffer.h"
#include "SkResourceCache.h"
+#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
@@ -34,14 +35,17 @@ public:
, fTile(tile)
, fTmx(tmx)
, fTmy(tmy)
- , fScale(scale)
- , fLocalMatrix(localMatrix) {
+ , fScale(scale) {
+
+ size_t matrixSize = localMatrix.writeToMemory(fLocalMatrixStorage);
+ SkASSERT(matrixSize <= sizeof(fLocalMatrixStorage));
+ sk_bzero(fLocalMatrixStorage + matrixSize, sizeof(fLocalMatrixStorage) - matrixSize);
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 +56,7 @@ private:
SkRect fTile;
SkShader::TileMode fTmx, fTmy;
SkSize fScale;
- SkMatrix fLocalMatrix;
+ uint8_t fLocalMatrixStorage[SkMatrix::kMaxFlattenSize];
mtklein 2014/12/10 19:52:47 Let's be even more explicit? This actually includ
f(malita) 2014/12/10 20:03:29 Done.
SkDEBUGCODE(uint32_t fEndOfStruct;)
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698