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

Unified Diff: include/core/SkFlattenable.h

Issue 768183002: Revert of Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « include/core/SkDrawLooper.h ('k') | include/core/SkMaskFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkFlattenable.h
diff --git a/include/core/SkFlattenable.h b/include/core/SkFlattenable.h
index 3cfa85af48787e1636062d8bc44899ac087a89f1..679f640d3c4012a7868486f9a02bdef4b3325d5f 100644
--- a/include/core/SkFlattenable.h
+++ b/include/core/SkFlattenable.h
@@ -12,6 +12,8 @@
class SkReadBuffer;
class SkWriteBuffer;
+
+#define SK_SUPPORT_LEGACY_DEEPFLATTENING
/*
* Flattening is straight-forward:
@@ -43,6 +45,24 @@
#define SK_DECLARE_UNFLATTENABLE_OBJECT() \
virtual Factory getFactory() const SK_OVERRIDE { return NULL; }
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+#define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \
+ SkFlattenable::Registrar(#flattenable, flattenable::DeepCreateProc, \
+ flattenable::GetFlattenableType());
+
+#define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \
+ private: \
+ static SkFlattenable* CreateProc(SkReadBuffer&); \
+ static SkFlattenable* DeepCreateProc(SkReadBuffer& buffer) { \
+ if (NeedsDeepUnflatten(buffer)) { \
+ return SkNEW_ARGS(flattenable, (buffer)); \
+ } \
+ return CreateProc(buffer); \
+ } \
+ friend class SkPrivateEffectInitializer; \
+ public: \
+ virtual Factory getFactory() const SK_OVERRIDE {return DeepCreateProc;}
+#else
#define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \
SkFlattenable::Registrar(#flattenable, flattenable::CreateProc, \
flattenable::GetFlattenableType());
@@ -53,6 +73,7 @@
friend class SkPrivateEffectInitializer; \
public: \
virtual Factory getFactory() const SK_OVERRIDE { return CreateProc; }
+#endif
// If your subclass will *never* need to be unflattened, declare this.
#define SK_DECLARE_NOT_FLATTENABLE_PROCS(flattenable) \
@@ -123,6 +144,11 @@
virtual void flatten(SkWriteBuffer&) const {}
protected:
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ static bool NeedsDeepUnflatten(const SkReadBuffer&);
+ SkFlattenable(SkReadBuffer&) {}
+#endif
+
static SkFlattenable* ReturnNullCreateProc(SkReadBuffer&) {
return NULL;
}
« no previous file with comments | « include/core/SkDrawLooper.h ('k') | include/core/SkMaskFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698