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); |