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

Unified Diff: src/core/SkPictureShader.cpp

Issue 395603002: Simplify flattening to just write enough to call the factory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 4 months 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 | « src/core/SkPathEffect.cpp ('k') | src/core/SkReadBuffer.h » ('j') | 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 65a2cd322291d2236754e3c965a81738d17aac1a..3e0eb65f6fff115286ae9b4a3aa907c2ef8ad50c 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -28,13 +28,14 @@ SkPictureShader::SkPictureShader(const SkPicture* picture, TileMode tmx, TileMod
SkIntToScalar(picture->height()));
}
-SkPictureShader::SkPictureShader(SkReadBuffer& buffer)
- : INHERITED(buffer) {
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+SkPictureShader::SkPictureShader(SkReadBuffer& buffer) : INHERITED(buffer) {
fTmx = static_cast<SkShader::TileMode>(buffer.read32());
fTmy = static_cast<SkShader::TileMode>(buffer.read32());
buffer.readRect(&fTile);
fPicture = SkPicture::CreateFromBuffer(buffer);
}
+#endif
SkPictureShader::~SkPictureShader() {
fPicture->unref();
@@ -49,9 +50,19 @@ SkPictureShader* SkPictureShader::Create(const SkPicture* picture, TileMode tmx,
return SkNEW_ARGS(SkPictureShader, (picture, tmx, tmy, localMatrix, tile));
}
-void SkPictureShader::flatten(SkWriteBuffer& buffer) const {
- this->INHERITED::flatten(buffer);
+SkFlattenable* SkPictureShader::CreateProc(SkReadBuffer& buffer) {
+ SkMatrix lm;
+ buffer.readMatrix(&lm);
+ TileMode mx = (TileMode)buffer.read32();
+ TileMode my = (TileMode)buffer.read32();
+ SkRect tile;
+ buffer.readRect(&tile);
+ SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromBuffer(buffer));
+ return SkPictureShader::Create(picture, mx, my, &lm, &tile);
+}
+void SkPictureShader::flatten(SkWriteBuffer& buffer) const {
+ buffer.writeMatrix(this->getLocalMatrix());
buffer.write32(fTmx);
buffer.write32(fTmy);
buffer.writeRect(fTile);
« no previous file with comments | « src/core/SkPathEffect.cpp ('k') | src/core/SkReadBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698