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

Unified Diff: src/core/SkReadBuffer.cpp

Issue 1858323002: Enable flattening/unflattening with custom unflatten procs (Closed) Base URL: https://skia.googlesource.com/skia.git@flattenable
Patch Set: Created 4 years, 8 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
Index: src/core/SkReadBuffer.cpp
diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp
index f220b5a9e61581b35772b5514c1c6fd307e56d8d..c7bda21a4b159cf790eb74a78a2f145c3fec5df1 100644
--- a/src/core/SkReadBuffer.cpp
+++ b/src/core/SkReadBuffer.cpp
@@ -348,9 +348,16 @@ SkFlattenable* SkReadBuffer::readFlattenable(SkFlattenable::Type ft) {
}
factory = fFactoryArray[index];
} else {
- factory = (SkFlattenable::Factory)readFunctionPtr();
- if (nullptr == factory) {
- return nullptr; // writer failed to give us the flattenable
+ SkString name;
+ this->readString(&name);
+
+ // Check if a custom Factory has been specified for this flattenable.
reed1 2016/04/11 15:07:48 Is this order (checking custom first) important? D
msarett 2016/04/19 18:03:50 Yes I think we should check custom first. I've th
+ factory = getCustomFactory(name.c_str());
+ if (!factory) {
+ factory = SkFlattenable::NameToFactory(name.c_str());
+ if (!factory) {
+ return nullptr; // writer failed to give us the flattenable
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698