Index: src/core/SkComposeShader.cpp |
diff --git a/src/core/SkComposeShader.cpp b/src/core/SkComposeShader.cpp |
index f7de73b205d45d652c2a2c9cfc0f560f2ba7f38b..3c5b55aae663e948e0c740d4dbcde3b9948d790a 100644 |
--- a/src/core/SkComposeShader.cpp |
+++ b/src/core/SkComposeShader.cpp |
@@ -26,8 +26,8 @@ SkComposeShader::SkComposeShader(SkShader* sA, SkShader* sB, SkXfermode* mode) { |
SkSafeRef(mode); |
} |
-SkComposeShader::SkComposeShader(SkReadBuffer& buffer) : |
- INHERITED(buffer) { |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+SkComposeShader::SkComposeShader(SkReadBuffer& buffer) : INHERITED(buffer) { |
fShaderA = buffer.readShader(); |
if (NULL == fShaderA) { |
fShaderA = SkNEW_ARGS(SkColorShader, ((SkColor)0)); |
@@ -38,6 +38,7 @@ SkComposeShader::SkComposeShader(SkReadBuffer& buffer) : |
} |
fMode = buffer.readXfermode(); |
} |
+#endif |
SkComposeShader::~SkComposeShader() { |
SkSafeUnref(fMode); |
@@ -66,8 +67,17 @@ private: |
}; |
#define SkAutoAlphaRestore(...) SK_REQUIRE_LOCAL_VAR(SkAutoAlphaRestore) |
+SkFlattenable* SkComposeShader::CreateProc(SkReadBuffer& buffer) { |
+ SkAutoTUnref<SkShader> shaderA(buffer.readShader()); |
+ SkAutoTUnref<SkShader> shaderB(buffer.readShader()); |
+ SkAutoTUnref<SkXfermode> mode(buffer.readXfermode()); |
+ if (!shaderA.get() || !shaderB.get()) { |
+ return NULL; |
+ } |
+ return SkNEW_ARGS(SkComposeShader, (shaderA, shaderB, mode)); |
+} |
+ |
void SkComposeShader::flatten(SkWriteBuffer& buffer) const { |
- this->INHERITED::flatten(buffer); |
buffer.writeFlattenable(fShaderA); |
buffer.writeFlattenable(fShaderB); |
buffer.writeFlattenable(fMode); |