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

Unified Diff: src/core/SkBitmapProcShader.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/SkBitmapProcShader.h ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcShader.cpp
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index e7cc035c7439c724d67d33a8691109006dcbe8ee..6e2a7ca6581f11dc63c1164a17ebc710896ed02f 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -39,13 +39,14 @@ SkBitmapProcShader::SkBitmapProcShader(const SkBitmap& src, TileMode tmx, TileMo
fTileModeY = (uint8_t)tmy;
}
-SkBitmapProcShader::SkBitmapProcShader(SkReadBuffer& buffer)
- : INHERITED(buffer) {
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+SkBitmapProcShader::SkBitmapProcShader(SkReadBuffer& buffer) : INHERITED(buffer) {
buffer.readBitmap(&fRawBitmap);
fRawBitmap.setImmutable();
fTileModeX = buffer.readUInt();
fTileModeY = buffer.readUInt();
}
+#endif
SkShader::BitmapType SkBitmapProcShader::asABitmap(SkBitmap* texture,
SkMatrix* texM,
@@ -63,9 +64,21 @@ SkShader::BitmapType SkBitmapProcShader::asABitmap(SkBitmap* texture,
return kDefault_BitmapType;
}
-void SkBitmapProcShader::flatten(SkWriteBuffer& buffer) const {
- this->INHERITED::flatten(buffer);
+SkFlattenable* SkBitmapProcShader::CreateProc(SkReadBuffer& buffer) {
+ SkMatrix lm;
+ buffer.readMatrix(&lm);
+ SkBitmap bm;
+ if (!buffer.readBitmap(&bm)) {
+ return NULL;
+ }
+ bm.setImmutable();
+ TileMode mx = (TileMode)buffer.readUInt();
+ TileMode my = (TileMode)buffer.readUInt();
+ return SkShader::CreateBitmapShader(bm, mx, my, &lm);
+}
+void SkBitmapProcShader::flatten(SkWriteBuffer& buffer) const {
+ buffer.writeMatrix(this->getLocalMatrix());
buffer.writeBitmap(fRawBitmap);
buffer.writeUInt(fTileModeX);
buffer.writeUInt(fTileModeY);
« no previous file with comments | « src/core/SkBitmapProcShader.h ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698